From 08f9603f85a63f408c502610f39adec5bc455c17 Mon Sep 17 00:00:00 2001 From: Marcel Kottmann Date: Tue, 14 Jan 2020 08:38:34 +0100 Subject: [PATCH] fix: fixes issue #1476 after introduced again by version 2.0.2 --- lib/monitor/run.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/monitor/run.js b/lib/monitor/run.js index dce4638a..610f5d77 100644 --- a/lib/monitor/run.js +++ b/lib/monitor/run.js @@ -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(); } @@ -365,13 +365,11 @@ 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); }); });