mde/jake — pull request #114 by joewhite (2012-03-26 03:38:42+00:00)
Title: Make jake.exec support streaming output on Windows

When you specify the `stdout: true` and/or `stderr: true` options to `jake.exec`, and `jake.exec` detects that it's running on Windows, it currently makes two behavior changes: it doesn't stream the output as the external command executes (instead waiting until the process exits to display any output); and it doesn't display any output at all if the external command returned a nonzero exit code. The former is an inconvenience; the latter is a serious loss of functionality, because without any output, you can't tell why your jake task failed.

These changes fix both problems by making Windows use `child_process.spawn` just like other platforms already did; and using a platform-specific shell (`cmd /c` on Windows, or the existing `sh -c` everywhere else).

I'm not wild about hard-coding the shell command per-platform, but I've seen other Node.js code that uses the same technique (e.g. [`npm/lib/utils/lifecycle.js`](https://github.com/isaacs/npm/blob/master/lib/utils/lifecycle.js)), and seeing the output of build tasks seems worth the change.