Macro duct::cmd [] [src]

macro_rules! cmd {
    ( $program:expr ) => { ... };
    ( $program:expr $(, $arg:expr )* ) => { ... };
}

Create a command with any number of of positional arguments, which may be different types (anything that implements Into<OsString>). See also the cmd function, which takes a collection of arguments.

Example

#[macro_use]
extern crate duct;
use std::path::Path;

fn main() {
    let arg1 = "foo";
    let arg2 = "bar".to_owned();
    let arg3 = Path::new("baz");

    let output = cmd!("echo", arg1, arg2, arg3).read();

    assert_eq!("foo bar baz", output.unwrap());
}