'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().