我想在 spawn 中运行 cmd,但是当我运行命令时,你不会得到回复。我该如何解决?
var terminal = require('child_process').spawn('cmd', ['/K'], { timeout : 1000*60*60*24 });
terminal.stdin.setEncoding = 'utf-8';
terminal.stdin.write(new Buffer('dir'));
terminal.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
terminal.on('exit', function (code) {
// console.log('child process exited with code ' + code);
});