-
Notifications
You must be signed in to change notification settings - Fork 369
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.exit before console buffer flushed in Windows #282
Comments
I've encountered similar issues in another project. There the pipe was to some other node process, not to the console, but the effect is the same. In CindyJS/CindyJS@46aeba3 I've addressed that using a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symptoms
If any test fails, not all the console output is shown (console output is truncated).
Problem does not show up in standard Windows
cmd
, but does show up if tests are run from Cygwin or within Sublime Text build system. In Cygwin, if the output is piped to a file instead of being displayed on the console then all the results show in the file, even though they did not show in the console when not piped.Environment
Minimal Example
I have the following test file,
tests.js
:Running from Cygwin, the result is:
(I.e., only the first console.log appears). But if I remove the
test.fail
line then all the output appears.Cause
My guess of the cause is given in the title. It appears that under different circumstances, sometimes the node console is asynchronous (perhaps due to the way Windows pipes work, I'm not sure), and doesn't flush the output after every write. When a test fails, line 130 in nodeunit/nodeunit
process.exit(1);
seems to recognize the error and exit the process, butprocess.exit
does not seem to always wait for the console output to be received by the terminal. To confirm this hypothesis, if I remove theprocess.exit
line, then the output is displayed correctly.Solution
A work-around seems to be to change lines 128-132 to the following:
This seems to produce the correct error code for the process and also show all the output. I don't know if there are any other side effects of not ending the process immediately in the callback function.
The text was updated successfully, but these errors were encountered: