pub fn run(command: &mut Command) -> CmdOutput
Expand description
Runs a command, returning a CmdOutput
(which will contain Some(lines)
, not a None)
Example:
use better_commands::run;
use std::process::Command;
let cmd = run(&mut Command::new("echo").arg("hi"));
// prints the following: [Line { printed_to: Stdout, time: Instant { tv_sec: 16316, tv_nsec: 283884648 }, content: "hi" }]
// (timestamp varies)
assert_eq!("hi", cmd.lines().unwrap()[0].content);