'error' 事件


当出现以下情况时触发 'error' 事件:

  1. 无法衍生进程;
  2. 无法杀死进程;
  3. 向子进程发送信息失败。

发生错误后, 'exit' 事件可能会也可能不会触发。 如果同时监听了 'exit''error' 事件,可能会多次调用处理函数。

参阅 subprocess.kill()subprocess.send()

The 'error' event is emitted whenever:

  1. The process could not be spawned, or
  2. The process could not be killed, or
  3. Sending a message to the child process failed.

The 'exit' event may or may not fire after an error has occurred. When listening to both the 'exit' and 'error' events, it is important to guard against accidentally invoking handler functions multiple times.

See also subprocess.kill() and subprocess.send().