@@ -23,22 +23,23 @@ use std::io::process::{Process, ProcessOutput};
23
23
#[ test]
24
24
fn test_destroy_once ( ) {
25
25
#[ cfg( not( target_os="android" ) ) ]
26
- static PROG : & ' static str = "echo" ;
26
+ static mut PROG : & ' static str = "echo" ;
27
+
27
28
#[ cfg( target_os="android" ) ]
28
- static PROG : & ' static str = "ls" ; // android don't have echo binary
29
+ static mut PROG : & ' static str = "ls" ; // android don't have echo binary
29
30
30
- let mut p = Process :: new ( PROG , [ ] ) . unwrap ( ) ;
31
+ let mut p = unsafe { Process :: new ( PROG , [ ] ) . unwrap ( ) } ;
31
32
p. signal_exit ( ) . unwrap ( ) ; // this shouldn't crash (and nor should the destructor)
32
33
}
33
34
34
35
#[ test]
35
36
fn test_destroy_twice ( ) {
36
37
#[ cfg( not( target_os="android" ) ) ]
37
- static PROG : & ' static str = "echo" ;
38
+ static mut PROG : & ' static str = "echo" ;
38
39
#[ cfg( target_os="android" ) ]
39
- static PROG : & ' static str = "ls" ; // android don't have echo binary
40
+ static mut PROG : & ' static str = "ls" ; // android don't have echo binary
40
41
41
- let mut p = match Process :: new ( PROG , [ ] ) {
42
+ let mut p = match unsafe { Process :: new ( PROG , [ ] ) } {
42
43
Ok ( p) => p,
43
44
Err ( e) => fail ! ( "wut: {}" , e) ,
44
45
} ;
@@ -49,13 +50,13 @@ fn test_destroy_twice() {
49
50
fn test_destroy_actually_kills ( force : bool ) {
50
51
51
52
#[ cfg( unix, not( target_os="android" ) ) ]
52
- static BLOCK_COMMAND : & ' static str = "cat" ;
53
+ static mut BLOCK_COMMAND : & ' static str = "cat" ;
53
54
54
55
#[ cfg( unix, target_os="android" ) ]
55
- static BLOCK_COMMAND : & ' static str = "/system/bin/cat" ;
56
+ static mut BLOCK_COMMAND : & ' static str = "/system/bin/cat" ;
56
57
57
58
#[ cfg( windows) ]
58
- static BLOCK_COMMAND : & ' static str = "cmd" ;
59
+ static mut BLOCK_COMMAND : & ' static str = "cmd" ;
59
60
60
61
#[ cfg( unix, not( target_os="android" ) ) ]
61
62
fn process_exists ( pid : libc:: pid_t ) -> bool {
@@ -91,7 +92,7 @@ fn test_destroy_actually_kills(force: bool) {
91
92
}
92
93
93
94
// this process will stay alive indefinitely trying to read from stdin
94
- let mut p = Process :: new ( BLOCK_COMMAND , [ ] ) . unwrap ( ) ;
95
+ let mut p = unsafe { Process :: new ( BLOCK_COMMAND , [ ] ) . unwrap ( ) } ;
95
96
96
97
assert ! ( process_exists( p. id( ) ) ) ;
97
98
0 commit comments