bunpen: preserve environment across exec boundary

This commit is contained in:
2024-08-27 18:35:37 +00:00
parent b9fc61e627
commit 7dbe64e52f
2 changed files with 2 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ fn do_exec(path: str, args: []str) (os::exec::error | void) = {
log::printfln("exec ({}): {}", path, joined);
};
rtext::check_error("exec", rtext::execve(path, args));
rtext::check_error("exec", rtext::execve(path, args, os::getenvs()));
// XXX: os::exec::exec offers no way to preserve argv0, but it does
// work if you don't care about that:

View File

@@ -12,8 +12,7 @@ export fn execve(path: str, argv: []str, envp: []str = []) (rt::errno | void) =
make_cstr(&path_buf, path): uintptr: u64,
// XXX: this "leaks" the c arrays, but not much can be done about that
to_cstr_array(argv): *[*]nullable *const c::char: uintptr: u64,
0,
// to_cstr_array(envp): *[*]nullable *const c::char: uintptr: u64,
to_cstr_array(envp): *[*]nullable *const c::char: uintptr: u64,
)?;
};