有没有什么Fiber遇到异常可以退出进程?

Is there a way to exit the process if any Fiber encounters an exception?

现在我有几根带环的光纤:

spawn {
  begin
    loop { }
  rescue e : MyType
  end
}

我在其中使用 begin/rescue 来捕获异常、打印消息并退出进程。有没有办法只指定一次以捕获整个 运行 程序中的任何异常,而不是在每个不同的光纤中重复使用 begin/rescue

没有。纤程内任何未处理的异常都会被挽救并打印到 stderr。如果您需要做其他事情,您将不得不在 fiber 体内捕获异常。