From 40d5e9074a0001d53901df2a2e081c8821b3dc22 Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Wed, 20 Nov 2013 08:49:40 -0800 Subject: [PATCH] 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. --- lib/child_process.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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') { -- 2.7.4