1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10 // ignore-emscripten Function not implemented.
15 use std::process::{Command, Stdio};
18 let mut args = env::args();
19 let me = args.next().unwrap();
20 let arg = args.next();
21 match arg.as_ref().map(|s| &s[..]) {
23 let mut s = Command::new(&me)
25 .stdin(Stdio::piped())
28 s.stdin.take().unwrap().write_all(b"foo\n").unwrap();
29 let s = s.wait().unwrap();
33 let s = Command::new(&me).arg("a2").status().unwrap();
37 let mut s = String::new();
38 io::stdin().read_line(&mut s).unwrap();
39 assert_eq!(s, "foo\n");