grunt で実行される node exec コマンドの次の例を教えてください。
echo
コマンドは実行中であり、hello-world.txt
作成されていgrunt.log.writeln
ますが、コールバック関数内のコマンドが起動していません。
var exec = require('child_process').exec,
child;
child = exec('echo hello, world! > hello-world.txt',
function(error, stdout, stderr){
grunt.log.writeln('stdout: ' + stdout);
grunt.log.writeln('stderr: ' + stderr);
if (error !== null) {
grunt.log.writeln('exec error: ' + error);
}
}
);
参考文献:
http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options