Child-process lifecycle helpers for the SDK: terminate a spawned process (with a Windows process-tree fallback) and wire an AbortSignal to a process.
Methods
(static) bindAbort(proc, signalopt, onAbortopt) → {function}
Bind an AbortSignal to a child process so that aborting stops the process, and so that the listeners are cleaned up automatically once the process exits or errors.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
proc | ChildProcess | The process to bind. | |
signal | AbortSignal | <optional> | Signal whose abort should terminate the process; when omitted a no-op cleanup is returned. |
onAbort | function | <optional> | Optional callback invoked after the process is stopped due to abort. |
Returns:
A cleanup function that detaches all listeners.
- Type:
- function
(static) stop(proc) → {void}
Terminate a child process if it is still running. On Windows the whole process tree is killed via taskkill /T /F, falling back to proc.kill() elsewhere or when taskkill fails.
Parameters:
| Name | Type | Description |
|---|---|---|
proc | ChildProcess | The process to stop. |
Returns:
- Type:
- void