is_process_alive

Function is_process_alive 

Source
pub fn is_process_alive(pid: i32) -> bool
Expand description

Check if a process with the given PID is still running.

This uses the ps command to check process existence, which works on both macOS and Linux.

ยงExamples

use mi6_core::is_process_alive;

// Our own process should be alive
let own_pid = std::process::id() as i32;
assert!(is_process_alive(own_pid));

// A non-existent PID should not be alive
assert!(!is_process_alive(999999999));