File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,23 @@ use std::process;
22
22
use std:: thread;
23
23
24
24
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...
26
26
thread:: spawn ( || {
27
27
thread:: sleep_ms ( 5000 ) ;
28
28
process:: exit ( 1 ) ;
29
29
} ) ;
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
+ } ;
30
39
let output = process:: Command :: new ( "sh" )
31
40
. arg ( "-c" )
32
- . arg ( "while echo y ; do : ; done | head" )
41
+ . arg ( command )
33
42
. output ( )
34
43
. unwrap ( ) ;
35
44
assert ! ( output. status. success( ) ) ;
You can’t perform that action at this time.
0 commit comments