pub fn kill_pid(pid: u32) -> Result<()>Expand description
Terminate one process by PID — SIGTERM on Unix; taskkill /F /T /PID
on Windows (which also takes the tree, since Windows has no
process-group signal).
Returns Err if the PID is 0 or out of range for pid_t (see the
module doc), or if the signal/command could not be delivered. A process
that has already exited surfaces as an error too (Unix ESRCH, Windows
non-zero taskkill exit) — callers treating “already gone” as success
should ignore the result, which is what every prior copy did.
1 is accepted here: to kill(2) a positive 1 is exactly one process
(row one of the table), not a special value. It only becomes the
broadcast when negated, which this function never does.