pub fn wait_pid(pid: u32, timeout: Duration) -> SysprimsResult<WaitPidResult>Expand description
Wait for a PID to exit, up to the provided timeout.
Returns:
Okwithtimed_out=trueif the process did not exit in time.Okwithexited=trueif the process was observed to have exited.Err(NotFound)if the PID does not exist at the time of the first check.Err(PermissionDenied)if the platform forbids even querying liveness.
ยงExamples
use std::time::Duration;
// Replaces: while kill -0 <pid>; do sleep ...; done
let res = sysprims_proc::wait_pid(std::process::id(), Duration::from_millis(1)).unwrap();
println!("timed_out: {}", res.timed_out);