Skip to main content

run_from_args

Function run_from_args 

Source
pub async fn run_from_args<I, T>(argv: I) -> i32
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,
Expand description

Run the formatter from an argv-style iterator, returning its exit code.

Every broker test that boots a node needs a formatted log directory first. Calling this beats spawning the binary: a subprocess needs a Cargo working tree to build from, which a Bazel test sandbox does not have, and the formatting is setup rather than the thing under test. The binary itself is covered end to end by tests/format_smoke.rs.

Malformed arguments print a diagnostic and return 2. Help and version requests print to stdout and return 0, without terminating the caller.