fix: move process group termination instead unix code block (#2481)
Co-authored-by: Alice Hau <ahau@squareup.com>
This commit is contained in:
@@ -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(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user