about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-04-13 09:19:07 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-04-13 12:41:37 -0700
commitdfc548dddafbf4e58a568329ebbe29f1eb36a0e8 (patch)
tree2a5556c9569230186275df690e96c1f5318f5128 /src/libcore
parentd2482fd7631d05b1888e3beac0df3f25d33867b8 (diff)
downloadrust-dfc548dddafbf4e58a568329ebbe29f1eb36a0e8.tar.gz
rust-dfc548dddafbf4e58a568329ebbe29f1eb36a0e8.zip
add option exec-env to set env variables during test execution
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/run.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/run.rs b/src/libcore/run.rs
index 0b82d79b331..34ba16844d8 100644
--- a/src/libcore/run.rs
+++ b/src/libcore/run.rs
@@ -98,7 +98,7 @@ fn with_envp<T>(env: option<[(str,str)]>,
     // On posixy systems we can pass a char** for envp, which is
     // a null-terminated array of "k=v\n" strings.
     alt env {
-      some (es) {
+      some(es) if !vec::is_empty(es) {
         let mut tmps = [];
         let mut ptrs = [];
 
@@ -111,7 +111,7 @@ fn with_envp<T>(env: option<[(str,str)]>,
         ptrs += [ptr::null()];
         vec::as_buf(ptrs) { |p| cb(::unsafe::reinterpret_cast(p)) }
       }
-      none {
+      _ {
         cb(ptr::null())
       }
     }
@@ -124,7 +124,7 @@ fn with_envp<T>(env: option<[(str,str)]>,
     // rather a concatenation of null-terminated k=v\0 sequences, with a final
     // \0 to terminate.
     alt env {
-      some (es) {
+      some(es) if !vec::is_empty(es) {
         let mut blk : [u8] = [];
         for vec::each(es) {|e|
             let (k,v) = e;
@@ -136,7 +136,7 @@ fn with_envp<T>(env: option<[(str,str)]>,
         blk += [0_u8];
         vec::as_buf(blk) {|p| cb(::unsafe::reinterpret_cast(p)) }
       }
-      none {
+      _ {
         cb(ptr::null())
       }
     }