|
sfcode
An Online Competing and Development Environment
|
Kill all processes in the process tree, including the root process.
Kill all the descendent processes of the process with pid 1, including the process with pid 1 itself:
Send a signal other than SIGTERM.:
Run a callback when done killing the processes. Passes an error argument if there was an error.
You can also install tree-kill globally and use it as a command:
Sends signal signal to all children processes of the process with pid pid, including pid. Signal defaults to SIGTERM.
For Linux, this uses ps -o pid --no-headers --ppid PID to find the parent pids of PID.
For Darwin/OSX, this uses pgrep -P PID to find the parent pids of PID.
For Windows, this uses ‘'taskkill /pid PID /T /F’` to kill the process tree. Note that on Windows, sending the different kinds of POSIX signals is not possible.
With npm do:
MIT
pid parameter to fix arbitrary code execution vulnerabilitykill(pid, callback) works. Before you had to use kill(pid, signal, callback)tree-kill CLI