Skip to content

Commit 941b93f

Browse files
fix: fixes issue #1476 after introduced again by version 2.0.2
1 parent cd45d74 commit 941b93f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/monitor/run.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ function run(options) {
321321
function waitForSubProcesses(pid, callback) {
322322
debug('checking ps tree for pids of ' + pid);
323323
psTree(pid, (err, pids) => {
324-
if (!pids.length) {
324+
if (err || !pids.length) {
325325
return callback();
326326
}
327327

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

368-
child.kill(signal);
369-
370368
pids.sort().forEach(pid => exec(`kill -${sig} ${pid}`, noop));
371369

372370
waitForSubProcesses(child.pid, () => {
373371
// finally kill the main user process
374-
exec(`kill -${sig} ${child.pid}`, callback);
372+
child.kill(signal);
373+
callback();
375374
});
376375

377376
});

0 commit comments

Comments
 (0)