about summary refs log tree commit diff
path: root/src/libstd/sys/vxworks/process
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-06 07:43:56 +0000
committerbors <bors@rust-lang.org>2019-12-06 07:43:56 +0000
commitd0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0 (patch)
tree1e574274dfc984cf278d7a39e154b408f1663485 /src/libstd/sys/vxworks/process
parent7b482cdf7ce55e05ee8392e1ade70966e3189cfd (diff)
parentacd2b0835d1b833b851501a9d255ee7882f45a84 (diff)
downloadrust-d0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0.tar.gz
rust-d0126e8ed3cc0d6fcb9dd44c36a46f9ce65010a0.zip
Auto merge of #67080 - JohnTitor:rollup-2t6fm3u, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #66649 (VxWorks: fix issues in accessing environment variables)
 - #66764 (Tweak wording of `collect()` on bad target type)
 - #66900 (Clean up error codes)
 - #66974 ([CI] fix the `! isCI` check in src/ci/run.sh)
 - #66979 (Add long error for E0631 and update ui tests.)
 - #67017 (cleanup long error explanations)
 - #67021 (Fix docs for formatting delegations)
 - #67041 (add ExitStatusExt into prelude)
 - #67065 (Fix fetching arguments on the wasm32-wasi target)
 - #67066 (Update the revision of wasi-libc used in wasm32-wasi)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libstd/sys/vxworks/process')
-rw-r--r--src/libstd/sys/vxworks/process/process_vxworks.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstd/sys/vxworks/process/process_vxworks.rs b/src/libstd/sys/vxworks/process/process_vxworks.rs
index 7446471ae31..79bfd770f8e 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,12 +53,19 @@ 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 stack_size = thread::min_stack();
+
+            // ensure that access to the environment is synchronized
+            let _lock = sys::os::env_lock();
+
             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.
+                stack_size,                           // initial stack size.
                 0,                                    // options
                 0                                     // task options
             );