Skip to content

Commit 0ffb771

Browse files
committed
Use yes except target_os = "nto".
1 parent 3b022d8 commit 0ffb771

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)