cri5ti/grunt-shell-spawn — pull request #17 by sergkr (2014-02-08 02:50:29+00:00)
Title: Fix for capturing stderr properly (#15)

Added some tests as well to make sure we're properly capturing stdout, stderr, and the exit code of both synchronous and asynchronous processes.

Some notes follow:

There's an unfortunate issue with error reporting that I noticed. Any message passed to grunt.fatal() isn't visible in the output of a failing test when running `npm test`. It just says "Error: Command failed:", and nothing else. I tried a bunch of things, but couldn't figure out a better way than what I'm currently doing, which is printing the error message using console.error(), and then calling grunt.fatal(). It's a bit repetitive, but at least the message shows up.

Also, there was a `wait` task which appeared to be unused (let me know if this is not correct). I decided to make better use of it by making it able to take a parameter representing the number of seconds to wait. This can be used for testing some of the async functionality by just including it as one of the tasks. For instance, I'm using it for the async test case to keep grunt running after launching the async process (as otherwise grunt just exits immediately):

grunt.registerTask('testProcessAsync', ['shell:testProcessAsync', 'wait:2']);