Skip to content

Instantly share code, notes, and snippets.

@timonv
Last active November 5, 2015 08:17
Show Gist options
  • Save timonv/8e2a395cc1f2f68ca2ab to your computer and use it in GitHub Desktop.
Save timonv/8e2a395cc1f2f68ca2ab to your computer and use it in GitHub Desktop.
use std::process::{Command, Child};
pub fn run() -> Result<Child> {
let child = try!(Command::new("echo").arg("world").spawn());
Ok(child)
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test_simple_command() {
let child = run().unwrap().wait_with_output().unwrap();
let result = String::from_utf8(child.stdout).unwrap();
assert_eq!(result, "world");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment