Y
Y
Yaroslav Lyzlov2013-07-15 14:15:06
Node.js
Yaroslav Lyzlov, 2013-07-15 14:15:06

Send child_process Control-C

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.on('exit', function (code) {
  console.log(code)
})
spawn.stdin.write('ping 8.8.8.8 -t'+ '\r\n');


Actually, the question is: how to stop ping, but not kill the process?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Shikanov, 2013-07-15
@dizballanze

Why not immediately start the child ping process? Then you can just kill him and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question