首页 Node.js核心模块手册

参数说明


on(event, callback)  
event          事件名称  
callback(      回调事件 
   ?                根据事件规定,参考事件列表
)

事件列表


方法 示例 描述
message
childprocess.on("message", fucntion(data){});

接收,子进程发送的数据

子进程方法:process.send("向父进程发送");

exit childprocess.on("exit", fucntion(code, signal){});

子进程退出时触发

code:子进程退出码,正常退出值为0,异常退出null signal:字符串,父进程关闭子进程发给子进程的名称

error childprocess.on("error", fucntion(err){}); 子进程开启失败时触发