cowboy/grunt — Issue #58: Suggestion: use child_process.exec instead of spawn in child_process helper task
Author: sean-lynch
Created: 2012-03-06 21:51:44+00:00
State: open

I've been migrating our custom tasks to use the built-in child_process helper task rather than our custom equivalent. I realized that the built in child_process uses spawn and two custom arrays to buffer output when exec provides this built in.

On top of that, .exec operates more closely to actual command line calls which is what I imagine child_process is typically used to emulate. For example, the command `handlebars templates/*.html --output=templates.js` works fine on the command line and in child_process.exec because they both expand the `*` wildcard. It fails when using spawn because spawn does not expand the wildcard.

The following is an implementation of the child_process helper using exec while maintaining the exact same function definition: https://gist.github.com/1989146