From c277a6bd130531702e2529f0410aa441328f187e Mon Sep 17 00:00:00 2001 From: Simon Warta <2603011+webmaster128@users.noreply.github.com> Date: Mon, 4 Feb 2019 16:22:53 +0100 Subject: [PATCH] fix(launcher): Debug Child Processes exit signal (#3259) The Child Processes Event: 'exit' has two parameters: code and signal (https://nodejs.org/api/child_process.html#child_process_event_exit). One of the two will always be non-null. This helps debugging cases where code is null. --- lib/launchers/process.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/launchers/process.js b/lib/launchers/process.js index 3734bed5c..072c15b81 100644 --- a/lib/launchers/process.js +++ b/lib/launchers/process.js @@ -79,8 +79,8 @@ function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) { self._process.stderr.on('data', self._onStderr) - self._process.on('exit', function (code) { - self._onProcessExit(code, errorOutput) + self._process.on('exit', function (code, signal) { + self._onProcessExit(code, signal, errorOutput) }) self._process.on('error', function (err) { @@ -100,8 +100,8 @@ function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) { }) } - this._onProcessExit = function (code, errorOutput) { - log.debug(`Process ${self.name} exited with code ${code}`) + this._onProcessExit = function (code, signal, errorOutput) { + log.debug(`Process ${self.name} exited with code ${code} and signal ${signal}`) let error = null @@ -156,7 +156,7 @@ function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) { // for a zombie child process to exit. self._killTimer = timer.setTimeout(function () { log.warn(`${self.name} was not killed by SIGKILL in ${killTimeout} ms, continuing.`) - self._onProcessExit(-1, '') + self._onProcessExit(-1, null, '') }, killTimeout) } }