[][src]Function psutil::process::all

pub fn all() -> Result<Vec<Process>>

Return a vector of all processes in /proc.

You may want to retry after a std::io::ErrorKind::NotFound error due to a race condition where the contents of /proc are read, and then a particular process dies before getting to read its info. See example below.

This example is not tested
loop {
    match psutil::process::all() {
        Ok(procs) => return Ok(procs),
        Err(why) => {
            if why.kind() != std::io::ErrorKind::NotFound {
                return Err(why);
            }
        }
    }
}