File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,23 @@ use std::process;
2222use std:: thread;
2323
2424fn 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+ // 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+ } ;
3039 let output = process:: Command :: new ( "sh" )
3140 . arg ( "-c" )
32- . arg ( "while echo y ; do : ; done | head" )
41+ . arg ( command )
3342 . output ( )
3443 . unwrap ( ) ;
3544 assert ! ( output. status. success( ) ) ;
You can’t perform that action at this time.
0 commit comments