Skip to main content

run

Function run 

Source
pub fn run<I, T>(args: I) -> u8
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Expand description

Parse args, run the selected command to completion, and return the exit code the process should use.

args is a complete argv, program name included. Diagnostics go to stderr in the same form the binary has always produced — anyhow’s Debug rendering, so an error’s source chain survives. The code is clap’s own for a usage error or for --help, and 1 for a command that ran and failed.

A plain u8 rather than ExitCode because ExitCode cannot be inspected, and the Python entry point has to hand the number back to the interpreter rather than exit the process itself.

Builds its own multi-thread tokio runtime rather than requiring one, so it works from a plain fn main and from a Python interpreter that has none.