Skip to content

Commit e79ccee

Browse files
committed
Use 'yes' for AIX.
1 parent 552a959 commit e79ccee

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/ui/process/process-sigpipe.rs

+11-2
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,23 @@ use std::process;
2222
use std::thread;
2323

2424
fn main() {
25-
// Just in case `yes` doesn't check for EPIPE...
25+
// Just in case `yes` or `while-echo` doesn't check for EPIPE...
2626
thread::spawn(|| {
2727
thread::sleep_ms(5000);
2828
process::exit(1);
2929
});
30+
// The 'sh' of AIX prints a message about a broken pipe with the command
31+
// using 'while-echo'. It works as expected when using 'yes' instead,
32+
// which was originally used in this test but later changed because some
33+
// platforms do not have 'yes'. Therefore, use 'yes' for AIX.
34+
let command = if cfg!(target_os = "aix") {
35+
"yes | head"
36+
} else {
37+
"while echo y ; do : ; done | head"
38+
};
3039
let output = process::Command::new("sh")
3140
.arg("-c")
32-
.arg("while echo y ; do : ; done | head")
41+
.arg(command)
3342
.output()
3443
.unwrap();
3544
assert!(output.status.success());

0 commit comments

Comments
 (0)