fix: move process group termination instead unix code block (#2481)

Co-authored-by: Alice Hau <ahau@squareup.com>
This commit is contained in:
Alice Hau
2025-05-08 14:28:12 -04:00
committed by GitHub
parent 01e28423ff
commit 1b47eee4c0
+7 -6
View File
@@ -59,13 +59,14 @@ pub async fn run_server(name: &str) -> Result<()> {
_ = shutdown.notified() => { _ = shutdown.notified() => {
// On Unix systems, kill the entire process group // On Unix systems, kill the entire process group
#[cfg(unix)] #[cfg(unix)]
fn terminate_process_group() { {
let pgid = getpgrp(); fn terminate_process_group() {
kill(Pid::from_raw(-pgid.as_raw()), Signal::SIGTERM) let pgid = getpgrp();
.expect("Failed to send SIGTERM to process group"); kill(Pid::from_raw(-pgid.as_raw()), Signal::SIGTERM)
.expect("Failed to send SIGTERM to process group");
}
terminate_process_group();
} }
terminate_process_group();
Ok(()) Ok(())
} }
} }