gruntjs / grunt

Grunt: The JavaScript Task Runner
http://gruntjs.com/
Other
12.27k stars 1.5k forks source link

Fixing process exit and output issues #921

Closed vladikoff closed 10 years ago

vladikoff commented 10 years ago

Merging all the process exit and output discussions into a single thread. There were several pull requests and issues regarding this problem:

https://github.com/gruntjs/grunt/issues/792 https://github.com/gruntjs/grunt/pull/708 https://github.com/gruntjs/grunt/issues/510 https://github.com/gruntjs/grunt/pull/664 https://github.com/gruntjs/grunt/pull/744 (!)

The exit branch should fix all the problems above: https://github.com/gruntjs/grunt/tree/exit

The branch uses this node module: https://npmjs.org/package/exit to workaround node.js exit issues. The node module tries to workaround https://github.com/joyent/node/issues/3584

benjamine commented 10 years ago

great (I hope this gets into node soon though, kinda lame that we need a module to exit :) )

Bartvds commented 10 years ago

Awesome. If the branch is ready for testing I'd be happy to try it out.

vladikoff commented 10 years ago

@Bartvds Yeah, I think if you test https://github.com/gruntjs/grunt/tree/exit , it should pick up exit 0.1.1 from npm. Let us know how it goes!

adamstallard commented 10 years ago

It seems to work with WebStorm (which is the pipe-redirect use case I personally care about)

vladikoff commented 10 years ago

@adamstallard that's great to hear!

Bartvds commented 10 years ago

:+1:

I tried this in some projects (git url as dependency), also using grunt in WebStorm (I have it configured as External Tool) and can confirm it works as expected.

I'll keep it active in my development project and see if it keeps up.

jakub-g commented 10 years ago

Seems it's working fine for me as well.

cowboy commented 10 years ago

This fix will be in 0.4.2, thanks everyone!

jameshowe commented 10 years ago

Guys, I am still seeing this issue when using Grunt 0.4.2 + Node 0.10.22 on Windows 7 Ultimate SP1. I am using Grunt to run some Mocha tests via TeamCity and I am finding the output is not consistent (sometimes all the tests show up, sometimes a couple, sometimes none). Looking at the output log I can see the output is abruptly cut off with a Process exited with code 0 message at the end.

To run this via TeamCity I use grunt-cli and grunt-mocha-cli and I use the mocha-teamcity-reporter to output the test results.

Read all the threads on this and can't seem to find a reliable way of getting around the issue. Any ideas?

vance commented 10 years ago

Yeah I can't get consistent exit codes. If I wait for end, it does nothing. If I don't, it actually gives erroneous error codes before tasks even run.

mcandre commented 10 years ago

grunt-cli is still outputting color codes when piped to less.

Do I need to update grunt and/or grunt-cli?

"grunt": "~0.4.5", "grunt-cli": "~0.1.13" Ubuntu 14.04