about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaoshanPang <pangbw@gmail.com>2019-11-04 15:15:49 -0800
committerBaoshanPang <pangbw@gmail.com>2019-11-22 14:36:53 -0800
commite20f630f1caf7e95a725ed524109fc168a9e1345 (patch)
tree750976eab912e2a184ff0d4c13f2ccdf5027f345
parent5fa0af2327944bd806b2fa382d4e983149ae7e4a (diff)
downloadrust-e20f630f1caf7e95a725ed524109fc168a9e1345.tar.gz
rust-e20f630f1caf7e95a725ed524109fc168a9e1345.zip
pass the captured environment variables to rtpSpawn
-rw-r--r--src/libstd/sys/vxworks/process/process_vxworks.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstd/sys/vxworks/process/process_vxworks.rs b/src/libstd/sys/vxworks/process/process_vxworks.rs
index 7446471ae31..1ec318e0745 100644
--- a/src/libstd/sys/vxworks/process/process_vxworks.rs
+++ b/src/libstd/sys/vxworks/process/process_vxworks.rs
@@ -15,6 +15,7 @@ impl Command {
                  -> io::Result<(Process, StdioPipes)> {
         use crate::sys::{cvt_r};
         const CLOEXEC_MSG_FOOTER: &'static [u8] = b"NOEX";
+        let envp = self.capture_env();
 
         if self.saw_nul() {
             return Err(io::Error::new(ErrorKind::InvalidInput,
@@ -52,10 +53,13 @@ impl Command {
                 t!(cvt(libc::chdir(cwd.as_ptr())));
             }
 
+            let c_envp = envp.as_ref().map(|c| c.as_ptr())
+                .unwrap_or_else(|| *sys::os::environ() as *const _);
+            
             let ret = libc::rtpSpawn(
                 self.get_argv()[0],                   // executing program
                 self.get_argv().as_ptr() as *mut *const c_char, // argv
-                *sys::os::environ() as *mut *const c_char,
+                c_envp as *mut *const c_char,
                 100 as c_int,                         // initial priority
                 thread::min_stack(),                  // initial stack size.
                 0,                                    // options