From: Timothy J Fontaine Date: Wed, 20 Nov 2013 16:49:40 +0000 (-0800) Subject: child_process: deliver ENOENT on nextTick X-Git-Tag: v0.11.9~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=40d5e9074a0001d53901df2a2e081c8821b3dc22;p=platform%2Fupstream%2Fnodejs.git 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. --- diff --git a/lib/child_process.js b/lib/child_process.js index 33928a9..96193a8 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') {