[][src]Function libproc::libproc::proc_pid::pidcwd

pub fn pidcwd(pid: pid_t) -> Result<PathBuf, String>

Gets path of current working directory for the process with the provided pid.

use std::io::Write;
use libproc::libproc::proc_pid::pidcwd;

match pidcwd(1) {
    Ok(cwd) => println!("The CWD of the process with pid=1 is '{}'", cwd.display()),
    Err(err) => writeln!(&mut std::io::stderr(), "Error: {}", err).unwrap()
}