Use close instead of exit

stdio might still be open when exit is called (http://nodejs.org/api/child_process.html#child_process_event_exit). With close you are
guaranteed that there will be no more output.
This commit is contained in:
probablycorey 2014-01-09 13:47:51 -08:00
parent ca6da5f9c1
commit d3c6bd2f98

View File

@ -39,7 +39,7 @@ module.exports = (grunt) ->
proc = childProcess.spawn(options.cmd, options.args, options.opts)
proc.stdout.on 'data', (data) -> stdout.push(data.toString())
proc.stderr.on 'data', (data) -> stderr.push(data.toString())
proc.on 'exit', (exitCode, signal) ->
proc.on 'close', (exitCode, signal) ->
error = new Error(signal) if exitCode != 0
results = {stderr: stderr.join(''), stdout: stdout.join(''), code: exitCode}
grunt.log.error results.stderr if exitCode != 0