Open barnabasbartha opened 4 years ago
Does the callback function gets executed?
var kill = require('tree-kill');
kill(1, 'SIGKILL', function(err) {
// Do things
});
Same problem in mac. The default SIGTERM cause self pid can not be killed. SIGKILL will kill self pid.
This is also work:
kill(1, function(err) {
// Do things
setTimeout(() => {
process.kill(1)
}, 200)
});
Same issue here. I've found out that the solution by ps-tree works:
psTree(child.pid, function (err, children) {
cp.spawn('kill', ['-9'].concat(children.map(function (p) { return p.PID })));
});
I do wonder if there's much point for this package to replicate the logic already in ps-tree
? Just have ps-tree
as a dependency and use in buildProcessTree
?
In some cases I want to kill a child process spawned from node, but even if I use this package giving the process's PID number, the process lives happily and does not close. Any idea?