Skip to main content

kill_gracefully

Function kill_gracefully 

Source
pub async fn kill_gracefully(
    child: &mut Child,
    grace_period: Duration,
    server_name: &str,
) -> KillOutcome
Expand description

Kill a child process gracefully: send SIGTERM, wait for the grace period, then send SIGKILL if still alive.

On non-Unix platforms (Windows), falls back to child.kill() immediately since SIGTERM is not well-defined.

§Arguments

  • child - The child process to kill.
  • grace_period - How long to wait after SIGTERM before sending SIGKILL.
  • server_name - Name of the server (for logging).

§Returns

The KillOutcome indicating whether the process exited gracefully or had to be killed.