use close event instead of exit to capture stdout/stderr correctly

This commit is contained in:
Brian Gough 2015-03-13 10:10:21 +00:00
parent 0e5abe1ff8
commit 63ee4d1e7d

View file

@ -27,8 +27,9 @@ module.exports = (command, options, callback = (err, stdout, stderr) ->) ->
logger.log process: child.pid, kill_error: error, "error killing process" logger.log process: child.pid, kill_error: error, "error killing process"
, options.timeout , options.timeout
child.on 'exit', (code, signal) -> child.on 'close', (code, signal) ->
cleanup signal err = if code then new Error("exit status #{code}") else signal
cleanup err
child.on 'error', (err) -> child.on 'error', (err) ->
cleanup err cleanup err