こんにちは、たとえば、ping 8.8.8.8-t、つまり無数のpingをchild_processに送信したいです。そして、このコマンドを停止して新しいコマンドを実行したい繰り返しのいくつかがありますが、この場合、子プロセスを強制終了したくありません。
例:
var spawn = require('child_process').spawn('cmd'),
iconv = require('iconv-lite');
spawn.stdout.on('data', function (data) {
console.log('Stdout: ', iconv.decode(data, 'cp866'));
});
spawn.stderr.on('data', function (data) {
console.log('Stderr: ', iconv.decode(data, 'cp866'));
});
spawn.stdin.write('ping 8.8.8.8 -t'+ '\r\n');
spawn.stdin.write(here control-c...); // WRONG
spawn.stdin.write('dir' + '\r\n');