darwin_libproc

Function pid_path

Source
pub fn pid_path(pid: pid_t) -> Result<PathBuf>
Expand description

Fetch executable absolute path for process with pid provided.

Examples found in repository?
examples/processes.rs (line 11)
6
7
8
9
10
11
12
13
14
15
fn main() -> io::Result<()> {
    let pids = darwin_libproc::all_pids()?;
    for pid in pids {
        println!("PID: #{}", pid);
        println!("\tName: {:?}", darwin_libproc::name(pid)?);
        println!("\tPath: {:?}", darwin_libproc::pid_path(pid)?);
    }

    Ok(())
}