Skip to content

Commit

Permalink
child_process: deliver ENOENT on nextTick
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tjfontaine committed Nov 20, 2013
1 parent 1fef66f commit 40d5e90
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 40d5e90

Please sign in to comment.