end-child-processes
v2.0.3
Published
Reliably ends all direct and indirect child processes of the current process
Readme
End-Child-Processes
This library ends all child processes spawned by the current process, including nested child processes. The current process itself remains unaffected.
Installation
npm install --save end-child-processesUsage
import { endChildProcesses } from "end-child-processes"
// spawn a long-running subprocess
import * as childProcess from "child_process"
childProcess.exec("node -e 'while (true) {}'")
// end all running subprocesses spawned by this program
await endChildProcesses()How it works
On Windows, this library does not attempt to end the WMIC.exe process since it
terminates on its own.
Related work
Dependent on your use case, these other libraries that might also be a good fit for you:
- ps-tree: displays information about all running subprocesses
- tree-kill: ends all processes in the process tree, including the current process
- @jub3i/tree-kill: ends all processes in the process tree, including the current process
