mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
pass the environment along to the execve calls
This commit is contained in:
parent
0fd382e713
commit
5cf100205e
1 changed files with 14 additions and 1 deletions
|
@ -589,7 +589,20 @@ fn roc_run_unix<I: IntoIterator<Item = S>, S: AsRef<OsStr>>(
|
|||
// envp is an array of pointers to strings, conventionally of the
|
||||
// form key=value, which are passed as the environment of the new
|
||||
// program. The envp array must be terminated by a NULL pointer.
|
||||
let envp = &[std::ptr::null()];
|
||||
let envp_cstrings: bumpalo::collections::Vec<CString> = std::env::vars_os()
|
||||
.flat_map(|(k, v)| {
|
||||
[
|
||||
CString::new(k.as_bytes()).unwrap(),
|
||||
CString::new(v.as_bytes()).unwrap(),
|
||||
]
|
||||
})
|
||||
.collect_in(&arena);
|
||||
|
||||
let envp: bumpalo::collections::Vec<*const libc::c_char> = envp_cstrings
|
||||
.iter()
|
||||
.map(|s| s.as_ptr())
|
||||
.chain([std::ptr::null()])
|
||||
.collect_in(&arena);
|
||||
|
||||
match executable {
|
||||
ExecutableFile::MemFd(fd, _) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue