Macro cmd_lib::spawn_with_output[][src]

spawn_with_output!() { /* proc-macro */ }

Run commands with/without pipes as a child process, returning a handle to capture the final output

// from examples/dd_test.rs:
let mut procs = vec![];
for _ in 0..4 {
    let proc = spawn_with_output!(
        sudo bash -c "dd if=$file of=/dev/null bs=$block_size skip=$off count=$cnt 2>&1"
    )?;
}

for (i, mut proc) in procs.into_iter().enumerate() {
    let output = proc.wait_result()?;
    run_cmd!(info "thread $i bandwidth: $bandwidth MB/s")?;
}