'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, guard against accidentally invoking handler functions multiple times.

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