@@ -68,7 +68,7 @@ pub struct ProcessOptions<'self> {
68
68
* If this is Some(vec-of-names-and-values) then the new process will
69
69
* have an environment containing the given named values only.
70
70
*/
71
- env : Option < & ' self [ ( ~str , ~str ) ] > ,
71
+ env : Option < ~ [ ( ~str , ~str ) ] > ,
72
72
73
73
/**
74
74
* If this is None then the new process will use the same initial working
@@ -171,7 +171,7 @@ impl Process {
171
171
Some ( fd) => ( None , fd)
172
172
} ;
173
173
174
- let res = spawn_process_os ( prog, args, options. env , options. dir ,
174
+ let res = spawn_process_os ( prog, args, options. env . clone ( ) , options. dir ,
175
175
in_fd, out_fd, err_fd) ;
176
176
177
177
unsafe {
@@ -444,7 +444,7 @@ struct SpawnProcessResult {
444
444
445
445
#[ cfg( windows) ]
446
446
fn spawn_process_os ( prog : & str , args : & [ ~str ] ,
447
- env : Option < & [ ( ~str , ~str ) ] > ,
447
+ env : Option < ~ [ ( ~str , ~str ) ] > ,
448
448
dir : Option < & Path > ,
449
449
in_fd : c_int , out_fd : c_int , err_fd : c_int ) -> SpawnProcessResult {
450
450
@@ -627,7 +627,7 @@ pub fn make_command_line(prog: &str, args: &[~str]) -> ~str {
627
627
628
628
#[ cfg( unix) ]
629
629
fn spawn_process_os ( prog : & str , args : & [ ~str ] ,
630
- env : Option < & [ ( ~str , ~str ) ] > ,
630
+ env : Option < ~ [ ( ~str , ~str ) ] > ,
631
631
dir : Option < & Path > ,
632
632
in_fd : c_int , out_fd : c_int , err_fd : c_int ) -> SpawnProcessResult {
633
633
@@ -717,7 +717,7 @@ fn with_argv<T>(prog: &str, args: &[~str], cb: &fn(**libc::c_char) -> T) -> T {
717
717
}
718
718
719
719
#[ cfg( unix) ]
720
- fn with_envp < T > ( env : Option < & [ ( ~str , ~str ) ] > , cb : & fn ( * c_void ) -> T ) -> T {
720
+ fn with_envp < T > ( env : Option < ~ [ ( ~str , ~str ) ] > , cb : & fn ( * c_void ) -> T ) -> T {
721
721
use vec;
722
722
723
723
// On posixy systems we can pass a char** for envp, which is a
@@ -749,7 +749,7 @@ fn with_envp<T>(env: Option<&[(~str, ~str)]>, cb: &fn(*c_void) -> T) -> T {
749
749
}
750
750
751
751
#[ cfg( windows) ]
752
- fn with_envp < T > ( env : Option < & [ ( ~str , ~str ) ] > , cb : & fn ( * mut c_void ) -> T ) -> T {
752
+ fn with_envp < T > ( env : Option < ~ [ ( ~str , ~str ) ] > , cb : & fn ( * mut c_void ) -> T ) -> T {
753
753
// On win32 we pass an "environment block" which is not a char**, but
754
754
// rather a concatenation of null-terminated k=v\0 sequences, with a final
755
755
// \0 to terminate.
@@ -1284,22 +1284,22 @@ mod tests {
1284
1284
}
1285
1285
1286
1286
#[cfg(unix,not(target_os=" android"))]
1287
- fn run_env(env: Option<& [(~str, ~str)]>) -> run::Process {
1287
+ fn run_env(env: Option<~ [(~str, ~str)]>) -> run::Process {
1288
1288
run::Process::new(" env", [], run::ProcessOptions {
1289
1289
env: env,
1290
1290
.. run::ProcessOptions::new()
1291
1291
})
1292
1292
}
1293
1293
#[cfg(unix,target_os=" android")]
1294
- fn run_env(env: Option<& [(~str, ~str)]>) -> run::Process {
1294
+ fn run_env(env: Option<~ [(~str, ~str)]>) -> run::Process {
1295
1295
run::Process::new(" /system/bin/sh", [~" -c",~" set"], run::ProcessOptions {
1296
1296
env: env,
1297
1297
.. run::ProcessOptions::new()
1298
1298
})
1299
1299
}
1300
1300
1301
1301
#[cfg(windows)]
1302
- fn run_env(env: Option<& [(~str, ~str)]>) -> run::Process {
1302
+ fn run_env(env: Option<~ [(~str, ~str)]>) -> run::Process {
1303
1303
run::Process::new(" cmd", [~" /c", ~" set"], run::ProcessOptions {
1304
1304
env: env,
1305
1305
.. run::ProcessOptions::new()
@@ -1344,7 +1344,7 @@ mod tests {
1344
1344
let mut new_env = os:: env( ) ;
1345
1345
new_env. push( ( ~"RUN_TEST_NEW_ENV ", ~" 123 "));
1346
1346
1347
- let mut prog = run_env(Some(new_env.slice(0, new_env.len()) ));
1347
+ let mut prog = run_env(Some(new_env));
1348
1348
let output = str::from_bytes(prog.finish_with_output().output);
1349
1349
1350
1350
assert!(output.contains(" RUN_TEST_NEW_ENV =123 " ) ) ;
0 commit comments