Skip to main content

zx

Macro zx 

Source
macro_rules! zx {
    ($fmt:literal $(, $arg:expr)* $(,)?) => { ... };
    ($sh:expr, $fmt:literal $(, $arg:expr)* $(,)?) => { ... };
}
Expand description

Build a ProcessPromise from a format string whose {} placeholders are replaced by quoted arguments ({{}} is a literal {}).

  • zx!("echo {}", arg) uses Shell::new(), i.e. the options of the current scope;
  • zx!(shell, "echo {}", arg) uses the given Shell.

Arguments may be anything implementing IntoZxArg: strings, numbers, paths, vectors (expanded into several quoted words) and ProcessOutputs (their stdout without the trailing newline).