Skip to content

Commit

Permalink
pass the captured environment variables to rtpSpawn
Browse files Browse the repository at this point in the history
  • Loading branch information
BaoshanPang committed Nov 22, 2019
1 parent 5fa0af2 commit e20f630
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libstd/sys/vxworks/process/process_vxworks.rs
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e20f630

Please sign in to comment.