Created
November 19, 2013 22:43
-
-
Save tjfontaine/7553906 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/child_process.js b/lib/child_process.js | |
index 33928a9..151897d 100644 | |
--- a/lib/child_process.js | |
+++ b/lib/child_process.js | |
@@ -952,7 +952,10 @@ ChildProcess.prototype.spawn = function(options) { | |
var err = this._handle.spawn(options); | |
- if (err) { | |
+ if (!constants) | |
+ constants = process.binding('constants'); | |
+ | |
+ if (err && (err * -1) != constants.ENOENT) { | |
// Close all opened fds on error | |
stdio.forEach(function(stdio) { | |
if (stdio.type === 'pipe') { | |
@@ -965,6 +968,12 @@ ChildProcess.prototype.spawn = function(options) { | |
throw errnoException(err, 'spawn'); | |
} | |
+ if (err) { | |
+ process.nextTick(function() { | |
+ self._handle.onexit(err); | |
+ }); | |
+ } | |
+ | |
this.pid = this._handle.pid; | |
stdio.forEach(function(stdio, i) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment