Skip to content

Commit 3970793

Browse files
committed
Replace yes command by while-echo
The `yes` command is not available on all platforms.
1 parent df61fca commit 3970793

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/ui/process/process-sigpipe.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
// libstd ignores SIGPIPE, and other libraries may set signal masks.
99
// Make sure that these behaviors don't get inherited to children
1010
// spawned via std::process, since they're needed for traditional UNIX
11-
// filter behavior. This test checks that `yes | head` terminates
11+
// filter behavior.
12+
// This test checks that `while echo y ; do : ; done | head` terminates
1213
// (instead of running forever), and that it does not print an error
1314
// message about a broken pipe.
1415

1516
// ignore-emscripten no threads support
1617
// ignore-vxworks no 'sh'
1718
// ignore-fuchsia no 'sh'
18-
// ignore-nto no 'yes'
1919

2020
use std::process;
2121
use std::thread;
@@ -27,7 +27,11 @@ fn main() {
2727
thread::sleep_ms(5000);
2828
process::exit(1);
2929
});
30-
let output = process::Command::new("sh").arg("-c").arg("yes | head").output().unwrap();
30+
let output = process::Command::new("sh")
31+
.arg("-c")
32+
.arg("while echo y ; do : ; done | head")
33+
.output()
34+
.unwrap();
3135
assert!(output.status.success());
3236
assert!(output.stderr.len() == 0);
3337
}

0 commit comments

Comments
 (0)