Skip to main content

graceful_kill_process_group

Function graceful_kill_process_group 

Source
pub fn graceful_kill_process_group(
    pid: u32,
    initial_signal: KillSignal,
    grace_period: Duration,
) -> GracefulTerminationResult
Expand description

Gracefully terminate a process group by PID.

This function implements a staged termination strategy:

  1. Send the initial signal (default: SIGTERM, or SIGINT for interactive processes)
  2. Wait up to grace_period for the process to exit
  3. If still running, send SIGKILL

Returns information about how the termination completed.

ยงArguments

  • pid - Process ID (will be used to resolve the process group)
  • initial_signal - Signal to try first (SIGINT, SIGTERM)
  • grace_period - How long to wait before SIGKILL