我想从node.js文件sync中运行一个grunt任务。
这是一个构建过程,因此所有失败的脚本/任务都应该停止构建。
我只试过
var res = grunt.tasks(['compile']);
console.log('res: ', res);
并运行我的编译任务,但CCD_ 1中没有存储任何内容。事实上,我看到任务是async
运行的,因为日志甚至在任务开始之前就出现了。
我该怎么做
顺便说一句,也试过
grunt.util.spawn({
grunt: true,
args: ['compile']
}, function(err, res, code) {
console.log('err', err);
});
但它没有给出任何输出,只是阻塞了我的命令行。。。
// If specified, the same grunt bin that is currently running will be
// spawned as the child command, instead of the "cmd" option.
我在这里读到的是,spawn
片段应该与grunt
一起运行,而不是像问题标题所暗示的那样直接与node
一起运行。