source: trip-planner-front/node_modules/tree-kill/README.md@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.9 KB
Line 
1Tree Kill
2=========
3
4Kill all processes in the process tree, including the root process.
5
6Examples
7=======
8
9Kill all the descendent processes of the process with pid `1`, including the process with pid `1` itself:
10```js
11var kill = require('tree-kill');
12kill(1);
13```
14
15Send a signal other than SIGTERM.:
16```js
17var kill = require('tree-kill');
18kill(1, 'SIGKILL');
19```
20
21Run a callback when done killing the processes. Passes an error argument if there was an error.
22```js
23var kill = require('tree-kill');
24kill(1, 'SIGKILL', function(err) {
25 // Do things
26});
27```
28
29You can also install tree-kill globally and use it as a command:
30```sh
31tree-kill 1 # sends SIGTERM to process 1 and its descendents
32tree-kill 1 SIGTERM # same
33tree-kill 1 SIGKILL # sends KILL instead of TERMINATE
34```
35
36Methods
37=======
38
39## require('tree-kill')(pid, [signal], [callback]);
40
41Sends signal `signal` to all children processes of the process with pid `pid`, including `pid`. Signal defaults to `SIGTERM`.
42
43For Linux, this uses `ps -o pid --no-headers --ppid PID` to find the parent pids of `PID`.
44
45For Darwin/OSX, this uses `pgrep -P PID` to find the parent pids of `PID`.
46
47For 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.
48
49Install
50=======
51
52With [npm](https://npmjs.org) do:
53
54```
55npm install tree-kill
56```
57
58License
59=======
60
61MIT
62
63Changelog
64=========
65
66
67## [1.2.2] - 2019-12-11
68### Changed
69- security fix: sanitize `pid` parameter to fix arbitrary code execution vulnerability
70
71## [1.2.1] - 2018-11-05
72### Changed
73- added missing LICENSE file
74- updated TypeScript definitions
75
76## [1.2.0] - 2017-09-19
77### Added
78- TypeScript definitions
79### Changed
80- `kill(pid, callback)` works. Before you had to use `kill(pid, signal, callback)`
81
82## [1.1.0] - 2016-05-13
83### Added
84- A `tree-kill` CLI
85
86## [1.0.0] - 2015-09-17
87### Added
88- optional callback
89- Darwin support
Note: See TracBrowser for help on using the repository browser.