UNPKG

887 BMarkdownView Raw
1Tree Kill
2=========
3
4Kill all processes in the process tree, including the root process.
5
6Example
7=======
8
9Kill all the children processes of the process with pid `1`, including the process with pid `1` itself:
10```js
11var kill = require('tree-kill');
12kill(1, 'SIGKILL');
13```
14
15Supports callbacks with error handling:
16```js
17var kill = require('tree-kill');
18kill(1, 'SIGKILL', function(err) {
19 // Do things
20});
21```
22
23
24Methods
25=======
26
27## require('tree-kill')(pid, [signal], [callback]);
28
29Sends signal `signal` to all children processes of the process with pid `pid`, including `pid`. Signal defaults to `SIGTERM`.
30
31For Linux, this uses `ps -o pid --no-headers --ppid PID` to find the parent pids of `PID`.
32
33For Windows, this uses `'taskkill /pid PID /T /F'` to kill the process tree.
34
35Install
36=======
37
38With [npm](https://npmjs.org) do:
39
40```
41npm install tree-kill
42```
43
44License
45=======
46
47MIT