To kill child process in Node.js, we call the kill
method.
For instance, we write
const proc = require("child_process").spawn("mongod");
proc.kill("SIGINT");
to call spawn
to run the mongod
program.
Then we call kill
with 'SIGINT'
to kill the process.