Report exit status to callback

This commit is contained in:
Kevin Sawicki
2013-03-07 17:01:00 -08:00
parent 01faf6ea1e
commit 689088c1a8

View File

@@ -8,9 +8,10 @@ class BufferedProcess
stdoutClosed = true
stderrClosed = true
processExited = true
exitCode = 0
triggerExitCallback = ->
if stdoutClosed and stderrClosed and processExited
options.exit?()
options.exit?(exitCode)
if options.stdout
stdoutClosed = false
@@ -26,7 +27,8 @@ class BufferedProcess
if options.exit
processExited = false
process.on 'exit', ->
process.on 'exit', (code) ->
exitCode = code
processExited = true
triggerExitCallback()