Skip to main content

run

Function run 

Source
pub fn run<I>(args: I, out: &mut dyn Write, err: &mut dyn Write) -> Outcome
where I: IntoIterator, I::Item: Into<OsString>,
Expand description

Runs the tool, writing its report to out and anything that went wrong to err.

args is the whole command line including the program name, as std::env::args_os gives it. Nothing is written to the process’s own streams, so a caller can capture both.

let mut out = Vec::new();
let mut err = Vec::new();
let outcome = cargo_critpath::cli::run(std::env::args_os(), &mut out, &mut err);
std::process::exit(outcome.code());