Reject exec promise with hash instead of string

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-07-12 12:18:53 -07:00
parent e59d15868d
commit 47a9d1284a
2 changed files with 3 additions and 2 deletions

View File

@@ -88,6 +88,7 @@ describe 'Child Processes', ->
describe "when the command fails", ->
it "executes the callback with error set to the exit status", ->
waitsForPromise shouldReject: true, ->
cmd = "exit 2"
cmd = "echo 'bad' >&2 && exit 2"
ChildProcess.exec(cmd).fail (error) ->
expect(error.exitStatus).toBe 2
expect(error.stderr).toBe "bad\n"

View File

@@ -15,7 +15,7 @@ class ChildProccess
$native.exec command, options, (exitStatus, stdout, stderr) ->
if exitStatus != 0
deferred.reject("Command '#{command}' failed with exit status #{exitStatus} and stderr '#{stderr}'")
deferred.reject({command, exitStatus, stderr})
else
deferred.resolve(stdout, stderr)