事件:'错误'


【Event: 'error'

每当发生以下情况时,会触发 'error' 事件:

【The 'error' event is emitted whenever:】

  • 无法创建进程。
  • 无法终止该进程。
  • 向子进程发送消息失败。
  • 子进程通过 signal 选项被终止。

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

【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.】

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

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