Last active
April 18, 2017 09:54
-
-
Save 1010real/5e9508cf72f0b7f1862e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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