Skip to content

Instantly share code, notes, and snippets.

@1010real
Last active April 18, 2017 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1010real/5e9508cf72f0b7f1862e to your computer and use it in GitHub Desktop.
Save 1010real/5e9508cf72f0b7f1862e to your computer and use it in GitHub Desktop.
var spawn = require('child_process').spawn;
var cmd = spawn('ruby', ['node_modules/grunt-cclogdelete/cclogdelete.rb', filepath], { cwd:"." });
var buff = "";
// 標準出力を受け取った際の処理(出力される毎にイベント発火)
cmd.stdout.on('data', function(data) {
// grunt.log.writeln('stdout:' + data);
buff += String(data);
});
// エラー時の処理
cmd.stderr.on('data', function(data) {
grunt.log.writeln('stderr: ' + data);
});
// コマンド実行終了時の処理
cmd.on('close', function(code) {
if (code !== 0) {
grunt.log.writeln('child process exited with code : ' + code);
}
// Print a success message.
grunt.log.writeln('File "' + f.dest + '" created.');
// Write the destination file.
grunt.file.write(f.dest, buff);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment