/// Load currently running procs, and die if there is a surprising error
///
/// Normally if this can load *any* processes it returns what it can find, and
/// prints errors for procs that can't be parsed. But if `die_on_any_errors` is
/// true it dies if it cannot parse a *single* process.
Load currently running procs, and die if there is a surprising error
Normally if this can load *any* processes it returns what it can find, and
prints errors for procs that can't be parsed. But if `die_on_any_errors` is
true it dies if it cannot parse a *single* process.
Load currently running procs and die if there is a surprising error Normally if this can load * any * processes it returns what it can find and prints errors for procs that can ' t be parsed . But if ` die_on_any_errors ` is true it dies if it cannot parse a * single * process .
fn load_procs(die_on_any_errors: bool) -> RunningProcs {
    match RunningProcs::currently_running() {
        Ok(procs) => procs,
        Err(ProcFsError::LoadProcsError(LoadProcsError { procs, errors })) => {
            let mut saw_real_error = false;
            for err in errors {
                match err {
                    // If the process no longer exists, that's fine
                    ProcFsError::Io(_) => {}
                    err => {
                        saw_real_error = true;
                        println!("WARN: Unexpected error loading some processes: {}", err);
                    }
                }
            }
            if die_on_any_errors && saw_real_error {
                Status::Critical.exit();
            }
            procs
        }
        Err(err) => {
            println!("ERROR: unable to load processes: {}", err);
            Status::Critical.exit();
        }
    }
}
fn load_procs ( die_on_any_errors : bool ) -> RunningProcs { match RunningProcs :: currently_running ( ) { Ok ( procs ) => procs , Err ( ProcFsError :: LoadProcsError ( LoadProcsError { procs , errors } ) ) => { let mut saw_real_error = false ; for err in errors { match err { // If the process no longer exists, that's fine ProcFsError :: Io ( _ ) => { } err => { saw_real_error = true ; println ! ( " " err ) ; } } } if die_on_any_errors && saw_real_error { Status :: Critical . exit ( ) ; } procs } Err ( err ) => { println ! ( " " err ) ; Status :: Critical . exit ( ) ; } } }
Load currently running procs, and die if there is a surprising error
Normally if this can load *any* processes it returns what it can find, and
prints errors for procs that can't be parsed.
Load currently running procs and die if there is a surprising error Normally if this can load * any * processes it returns what it can find and prints errors for procs that can ' t be parsed .
die_on_any_errors
bool