Node.js: How to send control C to child process
问题 I am writing one web-like linux shell using node.js + socket.io. Simple command like, ls, cd are working well. But when issue command like ping google.com, the stdout is printing endlessly. I tried to send Ctrl +C to stdin, but no luck. 1) spawn 'bash' process spawn = require('child_process').spawn; var sh = spawn('bash'); 2) send bash stdout to socket.io sh.stdout.on('data', function(data) { console.log('stdout' + data); listener.sockets.emit("stdout",new Buffer(data)); }); 3) Sending Ctl C