我有以下代码
// Parent.js
var cp = require('child_process');
var child = cp.fork('./pChild.js');
child.on('message', function(m) {
// Receive results from child process
console.log('received: ' + m);
});
// Send child process some work
child.send('First Fun');
// pChild.js
process.on('message', function(m) {
console.log("Helloooooooooo from pChild.js")
// Pass results back to parent process
process.send("Fun1 complete");
});
如何处理从 pChild.js 抛出的父级错误并终止进程?