'error' 事件


'error' 事件在以下情况下触发:

  • 无法衍生该进程。
  • 无法终止该进程。
  • 向子进程发送消息失败。
  • 子进程已通过 signal 选项中止。

发生错误后,'exit' 事件可能会也可能不会触发。 在监听 'exit''error' 事件时,防止多次意外调用句柄函数。

另见 subprocess.kill()subprocess.send()

The 'error' event is emitted whenever:

  • The process could not be spawned.
  • The process could not be killed.
  • Sending a message to the child process failed.
  • The child process was aborted via the signal option.

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