summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy J Fontaine <tjfontaine@gmail.com>2013-11-20 08:49:40 -0800
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-11-20 09:35:08 -0800
commit40d5e9074a0001d53901df2a2e081c8821b3dc22 (patch)
treebb7d83de84a32dfa328c4d1a3708993fb6dfcec5
parent1fef66ffd4cf302fec7be1e2fd86f209cf1ff0d3 (diff)
downloadnode-new-40d5e9074a0001d53901df2a2e081c8821b3dc22.tar.gz
child_process: deliver ENOENT on nextTick
After the uv upgrade, uv_spawn will now fail faster for certain failures like ENOENT. However, our tests and other people may be depending on that error being passed to the callback instead of a throw.
-rw-r--r--lib/child_process.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index 33928a945c..96193a8b25 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -952,7 +952,14 @@ ChildProcess.prototype.spawn = function(options) {
var err = this._handle.spawn(options);
- if (err) {
+ if (!constants)
+ constants = process.binding('constants');
+
+ if (-err == constants.ENOENT) {
+ process.nextTick(function() {
+ self._handle.onexit(err);
+ });
+ } else if (err) {
// Close all opened fds on error
stdio.forEach(function(stdio) {
if (stdio.type === 'pipe') {