Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/node-core-library > SubprocessTerminator

SubprocessTerminator class

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.

Signature:

export declare class SubprocessTerminator 

Remarks

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.

Properties

PropertyModifiersTypeDescription
RECOMMENDED_OPTIONS

static

readonly

ISubprocessOptions(BETA) The recommended options when creating a child process.

Methods

MethodModifiersDescription
killProcessTree(subprocess, subprocessOptions)static(BETA) Terminate the child process and all of its children.
killProcessTreeOnExit(subprocess, subprocessOptions)static(BETA) Registers a child process so that it will be terminated automatically if the current process is terminated.