How to kill childprocess in nodejs? How to kill childprocess in nodejs? shell shell

How to kill childprocess in nodejs?


If you can use node's built in child_process.spawn, you're able to send a SIGINT signal to the child process:

var proc = require('child_process').spawn('mongod');proc.kill('SIGINT');

An upside to this is that the main process should hang around until all of the child processes have terminated.