]>
Commit | Line | Data |
---|---|---|
416331ca XL |
1 | // run-pass |
2 | ||
0bf4aa26 | 3 | #![allow(unused_must_use)] |
1a4d82fc JJ |
4 | // Be sure that when a SIGPIPE would have been received that the entire process |
5 | // doesn't die in a ball of fire, but rather it's gracefully handled. | |
6 | ||
abe05a73 | 7 | // ignore-emscripten no processes |
48663c56 | 8 | // ignore-sgx no processes |
c34b1796 | 9 | |
85aaf69f | 10 | use std::env; |
c34b1796 AL |
11 | use std::io::prelude::*; |
12 | use std::io; | |
13 | use std::process::{Command, Stdio}; | |
1a4d82fc JJ |
14 | |
15 | fn test() { | |
c34b1796 AL |
16 | let _ = io::stdin().read_line(&mut String::new()); |
17 | io::stdout().write(&[1]); | |
18 | assert!(io::stdout().flush().is_err()); | |
1a4d82fc JJ |
19 | } |
20 | ||
21 | fn main() { | |
85aaf69f SL |
22 | let args: Vec<String> = env::args().collect(); |
23 | if args.len() > 1 && args[1] == "test" { | |
1a4d82fc JJ |
24 | return test(); |
25 | } | |
26 | ||
85aaf69f | 27 | let mut p = Command::new(&args[0]) |
c34b1796 AL |
28 | .stdout(Stdio::piped()) |
29 | .stdin(Stdio::piped()) | |
1a4d82fc | 30 | .arg("test").spawn().unwrap(); |
c34b1796 | 31 | drop(p.stdout.take()); |
1a4d82fc JJ |
32 | assert!(p.wait().unwrap().success()); |
33 | } |