pub fn graceful_kill_process_group(
pid: u32,
initial_signal: KillSignal,
grace_period: Duration,
) -> GracefulTerminationResultExpand description
Gracefully terminate a process group by PID.
This function implements a staged termination strategy:
- Send the initial signal (default: SIGTERM, or SIGINT for interactive processes)
- Wait up to
grace_periodfor the process to exit - 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