From 47a9d1284a050ba6c7306693e59bd2fdb9109c40 Mon Sep 17 00:00:00 2001 From: Corey Johnson & Nathan Sobo Date: Thu, 12 Jul 2012 12:18:53 -0700 Subject: [PATCH] Reject exec promise with hash instead of string --- spec/stdlib/child-process-spec.coffee | 3 ++- src/stdlib/child-process.coffee | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/stdlib/child-process-spec.coffee b/spec/stdlib/child-process-spec.coffee index afd9baaa7..7d57a21cb 100644 --- a/spec/stdlib/child-process-spec.coffee +++ b/spec/stdlib/child-process-spec.coffee @@ -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" diff --git a/src/stdlib/child-process.coffee b/src/stdlib/child-process.coffee index c7b9a9174..4f8db76bf 100644 --- a/src/stdlib/child-process.coffee +++ b/src/stdlib/child-process.coffee @@ -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)