-
-
Notifications
You must be signed in to change notification settings - Fork 432
wait for node to finish writing to stdout before exiting #101
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
Conversation
|
I realized that this is not going to work because this has been switched over to streams. On the previous version, I hooked into formatResult. You're going to need a more complete solution across all the formatters. |
|
Re-opening for exposure. |
|
Can you show me your node version? |
|
It's version 0.12.7. I'm still doing some digging as to what exactly is causing this. |
|
In my case, exit signal after stdout, node version is v4.2.2 |
|
In my test the process exit event comes before the stdout close event. That being said, using the callback from the write call to stdout to ensure
|
console.log and console.log with formatter functionality - added check to ensure writes have finished from the formatter - `done` event emitted after formatter completed execution
|
I've added a more complete solution across all the formatters. |
|
Can you show a demo code to match this issue? |
|
https://github.com/admosity/HTMLHint/blob/exit-test-case/test/executable.spec.js The test I added is kind of spotty. I've gotten it to fail once on v0.9.12. It fails pretty consistently on atom: |
|
@admosity can you upgrade your node to new version? |
|
I add the executable.spec tese case, and it run successed! |


It appears that the exit signal is fired before the entire stdout stream is flushed. This causes issues for editors/IDEs that listen for the process exit event (atom in my case):
Using this atom package: https://github.com/AtomLinter/linter-htmlhint
Early end of input:

Slapped on a quick fix to listen for the drain event for json (as that's what is used in the linter I am using).