-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Subprocess on windows unable to get stdout data #3871
Comments
I think your main problem is that you're calling I'm not sure why you'd be seeing differences between OS X and Windows though. Could be something about the way that mocha is implemented. |
I just changed it to use spawn, but the exact same thing happened. Here's my new spawn.js |
@airportyh Can you also log the stderr data? |
@piscisaureus handling stderr actually uncovered a bug in my code on windows - that it couldn't find the mocha executable: thanks for the catch. I've fixed that in the new version. |
So does your script work now? Can this be closed? |
@piscisaureus No, the problem persists. Same result. The next thing I can do is dig into what Mocha is doing to try to isolate. |
airporthyr: so does mocha actually run or not? Because in that case, spawn() is working fine :-) |
Spawn worked, but the stdout data event(s) didn't emit. See the results on Windows in the gist. |
One more suggestion: can you try to remove the |
Yeah, taking that out still doesn't let it receive any data events. It ends up hanging there with no data displayed. |
Drilled down to the Mocha source and was able to get closer. It looks like calling |
This is still a major issue at least on my system (Windows 8). Calling The 'grunt' project (a task runner) uses this code snippet to guarantee that pipes are flushed before exiting, and I successfully patched other projects e.g. typescript and mocha that way and it solved the problem for me.
see https://github.com/gruntjs/grunt/blob/master/lib/util/exit.js To me it looks very much as if this should be handled at a lower level (in node), in order to improve reliability and stability of node as a platform on Windows. |
+1 mistaecko |
After some recent API changes, as far as I see, the callback of So in the above code What do you think? |
|
Btw, the main ticket for this issue is #3584. |
+1 mistaecko |
…d because of node core bug <nodejs/node-v0.x-archive#3871>. I removed the contributed tests because I don't think it adds a lot of value.
Simply creating a subprocess and reading data from its stdout fails on Windows. However, strangely, I was only able to reproduce this bug when running a test under mocha - not sure what mocha's doing that's so special. Here is the gist that demonstrates the problem
https://gist.github.com/3365454
I am running Windows 7 inside VMWare.
The text was updated successfully, but these errors were encountered: