-
Notifications
You must be signed in to change notification settings - Fork 7.3k
child_process.spawn() fails in 0.9.7 (all platforms) #4674
Comments
/cc @piscisaureus and @sblom |
Still happens in |
@nponeccop, Is Regardless, Node 0.9 shouldn't quit when you try to invoke a missing process, so I understand at least part of the work that I need to do here. The |
I'll retest Upd: I just checked and |
Just reproduced this on Mac OS with a rather different stack trace in latest master (0.9.10-pre):
Looks to me like Node 0.9 just isn't happy with trying to spawn non-existent processes, but in two different ways between Posix and Windows. On Posix, |
Fixed by #4780. |
Using 0.10.1 (and 0.10.0) on Windows XP, I still get this error: C:\nodejs>node > var spawn = require('child_process').spawn; undefined > spawn('git') { domain: null, _events: {}, _maxListeners: 10, _closesNeeded: 1, ... _pendingEncoding: '' } ] } > events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:945:11) at Process.ChildProcess._handle.onexit (child_process.js:736:34) C:\nodejs> Similar to the cases reported by others, |
Install a newer version of git, which actually creates an EXE file. |
That's not the point - this system does not have With node.js 0.8.18/0.8.20, the same code survives and gives |
Perhaps I should make myself more clear - it is the termination of node.js which is the issue here, not the failure to spawn the non-existent executable. |
Well, you're not catching the 'error' event so what do you expect? Try |
The existing code does try to catch it: var spawn = require('child_process').spawn; var git = spawn('git'); ... git.on('error', function (err) { ... }); However, the Are we saying that this is now compulsory to chain-call Also, with 0.8 this is not an |
OT: according to http://nodejs.org/api/child_process.html, |
@bnoordhuis your suggestion seems to have reliably fixed the issue I am seeing on 0.10.1, so thanks a lot! |
The original issue I reported is still not fixed in 0.10.1: Typing |
@nponeccop Throwing from async code still crashes the repl as of 0.10. In master, it's already changed to use a domain to prevent that from happening. However, this is a subtle and rather significant behavior change, so it's not something we can do in a stable release. |
Open node REPL, enter:
0.8.x displays the result value and stays in REPL
0.9.x displays result value, then displays a stacktrace and exits REPL
Here is the trace:
Same error is displayed by
node-gyp
when it tries to build binary addons and runsreg.exe
tool to read registry to detect installed compilers, so the problem is not specific to REPL.The text was updated successfully, but these errors were encountered: