我正在创建一个 grunt 插件,它广泛使用了该grunt.util.spawn
功能(http://gruntjs.com/api/grunt.util#grunt.util.spawn)。我的插件的基本骨架如下:
'use strict';
module.exports = function (grunt) {
var spawn = require("child_process").spawn;
var createCommit = function (text) {
var commit = grunt.util.spawn({
cmd: "git",
args: ["commit","-a","-m", text]
}, function() {
console.log("FINISH! FINISH! FINISH!");
});
};
grunt.registerMultiTask("myplugin", "Plugin to commit awesome things", function () {
createCommit("0.2.0");
});
};
然而,当我试图执行这个垃圾任务时,console.log("FINISH! FINISH! FINISH!");
mi回调永远不会执行......有人可以帮助我吗?