I\'m using child_process.spawn/child_process.fork to start a number of child processes from a node.js application. When stopping the parent process with Ctrl-C the child pro
You could try catching SIGINT
in your child:
// child.js
process.on("SIGINT", function() { console.log("sigint caught") });
// parent.js
var fork = require("child_process").fork,
child = fork(__dirname + "/child.js");
Run parent.js
and press ^C
. Your child.js
should continue running in the background. I don't know what the effects of this will be during the lifetime of child.js
.
Here is an enlightening, albeit pretty old, discussion of the topic on the node.js mailing list.
You could call childprocess.disconnect();
in the parent or process.disconnect();
in the child.