事件:'exit'


【Event: 'exit'

当任何一个工作线程死亡时,集群模块将触发 'exit' 事件。

【When any of the workers die the cluster module will emit the 'exit' event.】

这可以通过再次调用 .fork() 来重新启动工作程序。

【This can be used to restart the worker by calling .fork() again.】

cluster.on('exit', (worker, code, signal) => {
  console.log('worker %d died (%s). restarting...',
              worker.process.pid, signal || code);
  cluster.fork();
}); 

child_process 事件:'exit'

【See child_process event: 'exit'.】