-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change kill signal and add unit test #91
Conversation
lib/killer.js
Outdated
@@ -2,7 +2,7 @@ const psTree = require('ps-tree'); | |||
const spawn = require('cross-spawn'); | |||
const { exec } = require('child_process'); | |||
|
|||
let KILL_SIGNAL = '15'; // SIGTERM | |||
let KILL_SIGNAL = '-15'; // SIGTERM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should remain 15
lib/killer.js
Outdated
@@ -21,10 +21,10 @@ module.exports = function kill(child) { | |||
} else { | |||
if (hasPS) { | |||
psTree(child.pid, function(err, kids) { | |||
spawn('kill', ['-s', KILL_SIGNAL, child.pid].concat( kids.map(p => p.PID) )).on('close', resolve); | |||
spawn('kill', [KILL_SIGNAL, child.pid].concat( kids.map(p => p.PID) )).on('close', resolve); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you should use '-' + KILL_SIGNAL
lib/killer.js
Outdated
}); | ||
} else { | ||
exec('kill -s ' + KILL_SIGNAL + ' ' + child.pid, resolve); | ||
exec('kill ' + KILL_SIGNAL + ' ' + child.pid, resolve); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do, I wasn't sure which way around you wanted it. Will fix up and update the PR.
Thanks for the PR! |
@gilamran at first I got spooked by the test failing, but then I saw that it was node6. Do you plan on keeping support for node6? |
Published version 4.2.7, thanks!! |
I noticed that my package.json scripts weren't being killed after the update to version 2.4.6. If I read the documentation correctly (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/kill.html) the actual kill command should be
kill -15
.This PR contains that update as well as a unit test to hopefully check the positive and negative case.