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

View File

@@ -59,13 +59,14 @@ pub async fn run_server(name: &str) -> Result<()> {
_ = shutdown.notified() => {
// On Unix systems, kill the entire process group
#[cfg(unix)]
fn terminate_process_group() {
let pgid = getpgrp();
kill(Pid::from_raw(-pgid.as_raw()), Signal::SIGTERM)
.expect("Failed to send SIGTERM to process group");
{
fn terminate_process_group() {
let pgid = getpgrp();
kill(Pid::from_raw(-pgid.as_raw()), Signal::SIGTERM)
.expect("Failed to send SIGTERM to process group");
}
terminate_process_group();
}
terminate_process_group();
Ok(())
}
}