diff options
| author | bors <bors@rust-lang.org> | 2013-09-18 22:15:59 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-18 22:15:59 -0700 |
| commit | 3c0013134cecbe9592f02ed5c6a94c06effb19d4 (patch) | |
| tree | 4c4db2e7638a0b3549108ff2aa9692ba5f6c826f /src/libstd | |
| parent | 4dacd736510b2ae28a54489fe88571f1a6de019f (diff) | |
| parent | c3ad785d83b583ad693424d9f0f993e36f0990f5 (diff) | |
| download | rust-3c0013134cecbe9592f02ed5c6a94c06effb19d4.tar.gz rust-3c0013134cecbe9592f02ed5c6a94c06effb19d4.zip | |
auto merge of #9280 : alexcrichton/rust/less-c++, r=brson
Some of the functions could be converted to rust, but the functions dealing with signals were moved to rust_builtin.cpp instead (no reason to keep the original file around for one function). Closes #2674 Because less C++ is better C++!
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/run.rs | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/libstd/run.rs b/src/libstd/run.rs index 7fdee0a7be6..362eab17fe7 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -643,15 +643,28 @@ fn spawn_process_os(prog: &str, args: &[~str], use libc::funcs::bsd44::getdtablesize; mod rustrt { - use libc::c_void; - #[abi = "cdecl"] extern { pub fn rust_unset_sigprocmask(); - pub fn rust_set_environ(envp: *c_void); } } + #[cfg(windows)] + unsafe fn set_environ(_envp: *c_void) {} + #[cfg(target_os = "macos")] + unsafe fn set_environ(envp: *c_void) { + externfn!(fn _NSGetEnviron() -> *mut *c_void); + + *_NSGetEnviron() = envp; + } + #[cfg(not(target_os = "macos"), not(windows))] + unsafe fn set_environ(envp: *c_void) { + extern { + static mut environ: *c_void; + } + environ = envp; + } + unsafe { let pid = fork(); @@ -685,7 +698,7 @@ fn spawn_process_os(prog: &str, args: &[~str], do with_envp(env) |envp| { if !envp.is_null() { - rustrt::rust_set_environ(envp); + set_environ(envp); } do with_argv(prog, args) |argv| { execvp(*argv, argv); |
