1
1
use crate :: io:: { self , Error , ErrorKind } ;
2
- use libc:: { self , c_int} ;
2
+ use libc:: { self , c_int, c_char } ;
3
3
use libc:: { RTP_ID } ;
4
-
4
+ use crate :: sys ;
5
5
use crate :: sys:: cvt;
6
6
use crate :: sys:: process:: rtp;
7
7
use crate :: sys:: process:: process_common:: * ;
@@ -16,8 +16,6 @@ impl Command {
16
16
use crate :: sys:: { cvt_r} ;
17
17
const CLOEXEC_MSG_FOOTER : & ' static [ u8 ] = b"NOEX" ;
18
18
19
- let envp = self . capture_env ( ) ;
20
-
21
19
if self . saw_nul ( ) {
22
20
return Err ( io:: Error :: new ( ErrorKind :: InvalidInput ,
23
21
"nul byte found in provided data" ) ) ;
@@ -54,19 +52,10 @@ impl Command {
54
52
t ! ( cvt( libc:: chdir( cwd. as_ptr( ) ) ) ) ;
55
53
}
56
54
57
- // let envp = envp.map(|c| c.as_ptr())
58
- // .unwrap_or(*sys::os::environ() as *const _);
59
- // FIXME: https://github.com/rust-lang/rust/issues/61993
60
- let envp_empty = CStringArray :: with_capacity ( 0 ) ;
61
- let envp = match envp {
62
- Some ( x) => x,
63
- None => envp_empty,
64
- } ;
65
- let envp = envp. as_ptr ( ) ;
66
55
let ret = rtp:: rtpSpawn (
67
56
self . get_argv ( ) [ 0 ] , // executing program
68
57
self . get_argv ( ) . as_ptr ( ) as * const _ , // argv
69
- envp as * const _ , // environment variable pointers
58
+ * sys :: os :: environ ( ) as * const * const c_char ,
70
59
100 as c_int , // initial priority
71
60
0x16000 , // initial stack size. 0 defaults
72
61
// to 0x4000 in 32 bit and 0x8000 in 64 bit
0 commit comments