File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 9
9
// Make sure that these behaviors don't get inherited to children
10
10
// spawned via std::process, since they're needed for traditional UNIX
11
11
// 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.
15
15
16
16
//@ ignore-vxworks no 'sh'
17
17
//@ ignore-fuchsia no 'sh'
@@ -22,14 +22,21 @@ 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
+ // 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
+ } ;
30
37
let output = process:: Command :: new ( "sh" )
31
38
. arg ( "-c" )
32
- . arg ( "while echo y ; do : ; done | head" )
39
+ . arg ( command )
33
40
. output ( )
34
41
. unwrap ( ) ;
35
42
assert ! ( output. status. success( ) ) ;
You can’t perform that action at this time.
0 commit comments