(pid: u32)
| 73 | |
| 74 | #[cfg(unix)] |
| 75 | pub(crate) fn process_is_running(pid: u32) -> bool { |
| 76 | // Use libc::kill with signal 0 instead of forking a subprocess. |
| 77 | // Returns true only if the process exists AND we can signal it. |
| 78 | // Returns false for non-existent PIDs (ESRCH) and PIDs owned by |
| 79 | // other users (EPERM) — callers should not interact with those. |
| 80 | unsafe { libc::kill(pid as i32, 0) == 0 } |
| 81 | } |
| 82 | |
| 83 | #[cfg(not(unix))] |
| 84 | pub(crate) fn process_is_running(_pid: u32) -> bool { |
no outgoing calls
no test coverage detected