// (…)
var childProcess;
try {
childProcess = require("child_process");
} catch (e) {
this.log(e, "error");
}
if (childProcess) {
childProcess.execFile("/bin/bash", ["mycommand.sh", args1, args2, args3], null, function (err, stdout, stderr) {
this.log("execFileSTDOUT:", JSON.stringify(stdout), 'debug');
this.log("execFileSTDERR:", JSON.stringify(stderr), 'debug');
});
this.log("Done", "debug");
} else {
this.log("Unable to require child process", "warning");
}
地址:https://gist.github.com/clochix/6882184
读写文件:
http://nodejs.org/api/fs.html#fs_fs_write_fd_buffer_offset_length_position_callback
类别:技术文章 | 阅读:405319 | 评论:0 |
标签:casperjs shell