Skip to content

Commit

Permalink
fix: fixes issue remy#1476 after introduced again by version 2.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelkottmann committed Jan 14, 2020
1 parent cd45d74 commit 941b93f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/monitor/run.js
Expand Up @@ -321,7 +321,7 @@ function run(options) {
function waitForSubProcesses(pid, callback) {
debug('checking ps tree for pids of ' + pid);
psTree(pid, (err, pids) => {
if (!pids.length) {
if (err || !pids.length) {
return callback();
}

Expand Down Expand Up @@ -365,13 +365,12 @@ function kill(child, signal, callback) {
// the sub processes need to be killed from smallest to largest
debug('sending kill signal to ' + pids.join(', '));

child.kill(signal);

pids.sort().forEach(pid => exec(`kill -${sig} ${pid}`, noop));

waitForSubProcesses(child.pid, () => {
// finally kill the main user process
exec(`kill -${sig} ${child.pid}`, callback);
child.kill(signal);
callback();
});

});
Expand Down

0 comments on commit 941b93f

Please sign in to comment.