Depending on the options passed through, we might not have stdout and stderr.

This commit is contained in:
joshaber 2016-02-16 10:16:39 -05:00
parent a89257d474
commit 7f239560f8

View File

@ -52,8 +52,10 @@ module.exports = (grunt) ->
stderr = []
error = null
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())
if proc.stdout?
proc.stdout.on 'data', (data) -> stdout.push(data.toString())
if proc.stderr?
proc.stderr.on 'data', (data) -> stderr.push(data.toString())
proc.on 'error', (processError) -> error ?= processError
proc.on 'close', (exitCode, signal) ->
error ?= new Error(signal) if exitCode isnt 0