【发布时间】:2013-09-05 15:59:58
【问题描述】:
我生了很多孩子
var spawn = require('child_process').spawn,
newProcess1 = spawn('node', ['File1.js']),
newProcess2 = spawn('node', ['File2.js']),
newProcess3 = spawn('node', ['File3.js']);
它将并行运行。如果 newProcess1 失败,则 newProcess2 和 newProcess3 如果尚未启动,则必须停止或终止。
如何杀死子进程?
【问题讨论】:
-
这个
newProcess1.kill();怎么样 -
@Amol M Kulkarni newProcess1 将失败它应该与 newProcess2 和 newProcess3 同时被杀死
标签: multithreading node.js asynchronous child-process