Skip to content

Commit

Permalink
fix(launcher): Debug Child Processes exit signal (#3259)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
webmaster128 authored and johnjbarton committed Feb 4, 2019
1 parent bd95d89 commit c277a6b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/launchers/process.js
Expand Up @@ -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) {
Expand All @@ -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

Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit c277a6b

Please sign in to comment.