Skip to content
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

stdout not flushed on process.exit (Windows only) #504

Closed
queequac opened this issue Nov 2, 2012 · 4 comments
Closed

stdout not flushed on process.exit (Windows only) #504

queequac opened this issue Nov 2, 2012 · 4 comments

Comments

@queequac
Copy link

queequac commented Nov 2, 2012

The subject is nearly the whole story and there is no problem while working from within the command shell only. But it leads to missing logs when the console output is redirected to other processes, such as IDEs.

For example I have integrated Grunt into Sublime Text 2 and Eclipse, so these can be used for writing JavaScript code. Grunt is simply an external build tool from the IDEs point of view and output is shown in a special console area.

I have been stumbling over several comparable issues, e.g. nodejs/node-v0.x-archive#3871 and satyr/coco#168

Anyhow, the issue is that process.exit() will terminate node immediately, even if there are still queued writes to stdout. A workaround would be to simply remove this call where possible.

In case of grunt this would be /lib/grunt.js (line 135) for successfull builds. ;-)
I am not sure if this explicit exit is really neccessary. If it is there just to be on the safe side, maybe it could be removed (at least under Windows) to make integration into 3rd party tools more reliable.
I have tested it, it really works by commenting out the line mentioned above.

But I have no idea how to handle failed builds (/lib/grunt/fail.js, lines 42 and 73), since the call to process.exit is required for errorcodes there. Maybe there is some way to explicitly flush stdout and stderr before exiting, but I could not figure out how...

Cheers, Roland

@cowboy
Copy link
Member

cowboy commented Nov 2, 2012

I'm pretty sure I fixed this in 0.4.0 devel with 7f3c26b. Can you try 0.4.0a and see if that fixes the problem?

@queequac
Copy link
Author

queequac commented Nov 2, 2012

The new util.exit has correct stdout flushing, thanks for the fast reply! 👍
Hopefully v0.4.0 will be released soon. ;-)

@matthiasg
Copy link

@queequac i am having issues with regular node stdout flushing. what NEW util.exit where you talking about? Is this a util.exit in node.js or in grunt?

@matthiasg
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants