Wait for background workers before finish notices and cancel tools on shutdown

This commit is contained in:
2026-11-07 23:01:42 +00:00
parent 3134be3ebf
commit 15f26c55bb
15 changed files with 2520 additions and 325 deletions
+4 -2
View File
@@ -24,6 +24,7 @@ pub enum Input {
reply: mpsc::UnboundedSender<Value>,
},
Stop,
Shutdown,
}
pub type Sender = mpsc::UnboundedSender<Input>;
@@ -78,7 +79,8 @@ pub(super) fn console(sender: Sender) {
});
}
pub(super) fn stop_signal(
/// Register SIGTERM and SIGINT before the harness starts.
pub fn stop_signal(
sender: Sender,
) -> std::io::Result<impl std::future::Future<Output = ()> + Send> {
// Register before V8 starts, so a stop cannot arrive before the listener.
@@ -89,6 +91,6 @@ pub(super) fn stop_signal(
_ = interrupt.recv() => {}
_ = terminate.recv() => {}
}
let _ = sender.send(Input::Stop);
let _ = sender.send(Input::Shutdown);
})
}