-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process.on beforeExit broken on Windows #9067
Comments
@joaocgreis what happens if you follow it up by adding a |
does not make any difference, still gets stuck in a loop printing |
@joaocgreis I meant, does that make it loop with a pipe, or still not? |
That isn't too surprising. The same could happen on Unices with a slow reader and a full pipe.
That seems an unlikely culprit, seeing how it only touches files in deps/v8. |
Seems to be expected behavior to me. |
Expected behaviour as described by @seishun, and documented: https://nodejs.org/api/process.html#process_event_beforeexit |
This was surprising for me. Thanks for your help! |
Investigating #8821 (comment) , I found that
process.on('beforeExit', ...)
is broken on Windows if node is not invoked from the Windows Command Prompt. Here is a simple repro:This triggers an infinite loop printing
beforeExit
tostdout
. This happens when node spawns itself (as in the repro above) or when node is started from gitbash. This does not happen when node is started from the Windows Command Prompt withnode -e "process.on('beforeExit', () => console.log('beforeExit')); console.log('start')"
but happens with
so it might be related to output redirection or output not being a TTY.
Bisected, first bad commit is c431725 (V8 4.5 update before node v4.0.0).
cc @nodejs/platform-windows @bnoordhuis
The text was updated successfully, but these errors were encountered: