gruntjs/grunt — pull request #691 by dylang (2013-02-26 16:23:48+00:00)
Title: avoid losing error messages due to grunt.error.log using stdout instead of stderr

Since `grunt.log.error` currently use `stdout` instead of `stderr`, when an error happens when using `grunt.spawn` to spawn other Grunt tasks, the error can be lost when using `results.toString()`.

I've modified `spawn`'s `results.toString()` to fall back to `stdout` when `grunt` is being spawned and `stderr` is empty.

Note 1: I saw a comment from @Cowboy that said we'll move to `stderr` in Grunt 0.5. I think that's good, but in the meanwhile this will help with problems we've had that we difficult to solve because of the lost error messages. I don't think the changes in this ticket will need to be rolled back when we move to `stderr`.

Note 2: One example of this problem happens in [grunt-parallel](https://github.com/iammerrick/grunt-parallel). You wouldn't see failed task output unless you set `options: { stdio: "inherit"}` which has other consequences that may not be desired. I submitted iammerrick/grunt-parallel/pull/2 to work around this issue but it felt like a hack to work around fault in Grunt, hence this PR.