From eb662656701ed3f5338915b6e838bd91bddece10 Mon Sep 17 00:00:00 2001 From: timvisee Date: Tue, 23 Nov 2021 13:00:10 +0100 Subject: [PATCH] Handle SIGTERM exit code as successful --- src/server.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/server.rs b/src/server.rs index 8410cbc..ada6acb 100644 --- a/src/server.rs +++ b/src/server.rs @@ -27,6 +27,10 @@ const SERVER_QUIT_COOLDOWN: Duration = Duration::from_millis(2500); #[cfg(feature = "rcon")] const RCON_COOLDOWN: Duration = Duration::from_secs(15); +/// Exit code when SIGTERM is received on Unix. +#[cfg(unix)] +const UNIX_EXIT_SIGTERM: i32 = 130; + /// Shared server state. #[derive(Debug)] pub struct Server { @@ -443,6 +447,11 @@ pub async fn invoke_server_cmd( debug!(target: "lazymc", "Server process stopped successfully ({})", status); false } + #[cfg(unix)] + Ok(status) if status.code() == Some(UNIX_EXIT_SIGTERM) => { + debug!(target: "lazymc", "Server process stopped successfully by SIGTERM ({})", status); + false + } Ok(status) => { warn!(target: "lazymc", "Server process stopped with error code ({})", status); state.state() == State::Started