Home > @rushstack/node-core-library > SubprocessTerminator
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
When a child process is created, registering it with the SubprocessTerminator will ensure that the child gets terminated when the current process terminates.
export declare class SubprocessTerminator
This works by hooking the current process's events for SIGTERM/SIGINT/exit, and ensuring the child process gets terminated in those cases.
SubprocessTerminator doesn't do anything on Windows, since by default Windows automatically terminates child processes when their parent is terminated.
|RECOMMENDED_OPTIONS||ISubprocessOptions||(BETA) The recommended options when creating a child process.|
|killProcessTree(subprocess, subprocessOptions)||(BETA) Terminate the child process and all of its children.|
|killProcessTreeOnExit(subprocess, subprocessOptions)||(BETA) Registers a child process so that it will be terminated automatically if the current process is terminated.|