Use grunt.util.spawn for jsx:* tasks instead of exec.

This should prevent "Warning: stdout maxBuffer exceeded" errors.

Also piping child process stdout and stderr to the parent process, so
you can see more of what's happening during the build process.
This commit is contained in:
Ben Newman
2013-06-17 13:54:30 -04:00
parent fad7d58fc9
commit 96b0a0253f

View File

@@ -1,14 +1,14 @@
'use strict';
var exec = require("child_process").exec;
var expand = require("grunt").file.expand;
var grunt = require("grunt");
var expand = grunt.file.expand;
var spawn = grunt.util.spawn;
module.exports = function() {
var done = this.async();
var config = this.data;
var args = [
"bin/jsx",
"--cache-dir", ".module-cache",
"--relativize",
config.sourceDir,
@@ -25,5 +25,18 @@ module.exports = function() {
args.push.apply(args, rootIDs);
args.push("--config", config.configFile);
exec(args.join(" "), done);
var child = spawn({
cmd: "bin/jsx",
args: args
}, function(error, result, code) {
if (error) {
grunt.log.error(error);
done(false);
} else {
done();
}
});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
};