Skip to main content

kill_process_group

Function kill_process_group 

Source
pub fn kill_process_group(pid: u32)
Expand description

Terminate a process group led by pid, with escalation: SIGTERM to the group, a short grace, then SIGKILL to the group. On Windows the same taskkill /F /T /PID as kill_pid — there is no group signal, and /T already takes the tree.

Unix callers must have spawned the child as a group leader (process_group(0) / setsid) for the negative-pid signal to reach its descendants; that is the contract every prior copy relied on. Best-effort: nothing is returned because there is nothing useful a caller can do about a failed kill of an already-dying group.

A PID of 0, 1, or anything out of range for pid_t is a no-op. 0 and out-of-range are refused by [checked_pid]; 1 is refused here specifically because this function negates its argument and kill(-1, …) is the system-wide broadcast (row three of the module-doc table), not “process group 1”.