Skip to content

Commit edcde4c

Browse files
authored
Unrolled build for rust-lang#136936
Rollup merge of rust-lang#136936 - xingxue-ibm:sigpipe-test, r=workingjubilee Use 'yes' instead of 'while-echo' in tests/ui/process/process-sigpipe.rs except 'nto' The `sh` of AIX prints a message about a broken pipe when using the `while-echo` command. It works as expected when using the `yes` command instead. `yes` was originally used in this test but was later replaced with `while-echo` because QNX Neutrino does not have `yes` ([Replace yes command by while-echo in test tests/ui/process/process-sigpipe.rs](rust-lang#109379)). This PR updates the test to use `while-echo` for QNX Neutrino while reverting to `yes` for other platforms.
2 parents 17c1c32 + 0ffb771 commit edcde4c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tests/ui/process/process-sigpipe.rs

+12-5
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
// Make sure that these behaviors don't get inherited to children
1010
// spawned via std::process, since they're needed for traditional UNIX
1111
// filter behavior.
12-
// This test checks that `while echo y ; do : ; done | head` terminates
13-
// (instead of running forever), and that it does not print an error
14-
// message about a broken pipe.
12+
// This test checks that `yes` or `while echo y ; do : ; done | head`
13+
// terminates (instead of running forever), and that it does not print an
14+
// error message about a broken pipe.
1515

1616
//@ ignore-vxworks no 'sh'
1717
//@ ignore-fuchsia no 'sh'
@@ -22,14 +22,21 @@ 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+
// QNX Neutrino does not have `yes`. Therefore, use `while-echo` for `nto`
31+
// and `yes` for other platforms.
32+
let command = if cfg!(target_os = "nto") {
33+
"while echo y ; do : ; done | head"
34+
} else {
35+
"yes | head"
36+
};
3037
let output = process::Command::new("sh")
3138
.arg("-c")
32-
.arg("while echo y ; do : ; done | head")
39+
.arg(command)
3340
.output()
3441
.unwrap();
3542
assert!(output.status.success());

0 commit comments

Comments
 (0)