Skip to content

Commit fff8503

Browse files
authored
Rollup merge of #109379 - flba-eb:108596_fixtest_sigpipe, r=jyn514
Replace `yes` command by `while-echo` in test `tests/ui/process/process-sigpipe.rs` The `yes` command is not available on all platforms. Fixes #108596. Inviting `@mvf` as he contributed to this patch. Thanks! This issue has been discussed in #106673 but was moved to #108596 to get going. CC `@gh-tr` r? `@workingjubilee` `@rustbot` label +O-neutrino Notes about the comments #106673 (comment): - The `echo` command is `/proc/boot/echo` (not built-in) - `/bin/sh` is a symlink to `/proc/boot/ksh` ```sh # ls -l /bin/sh /proc/boot/ksh /proc/boot/echo lrwxrwxrwx 1 root root 14 Mar 20 07:52 /bin/sh -> /proc/boot/ksh -r-xr-xr-x 1 root root 9390 Sep 12 2022 /proc/boot/echo -r-xr-xr-x 1 root root 308114 Sep 12 2022 /proc/boot/ksh ```
2 parents ab7e01e + 3970793 commit fff8503

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)