bunpen: --bunpen-drop-shell: specify argv0 more correctly

This commit is contained in:
2024-08-25 19:24:32 +00:00
parent ec7b87b985
commit 289e9182fd

View File

@@ -13,7 +13,7 @@ fn do_exec(name: str, args: []str) (os::exec::error | void) = {
{
let joined = strings::join(" ", args...);
defer free(joined);
log::printfln("exec: {}", joined);
log::printfln("exec ({}): {}", name, joined);
};
let path = args[0];
@@ -50,7 +50,8 @@ export fn main() void = {
restrict::namespace_restrict(&what);
restrict::landlock_restrict(&what);
if (opts.drop_shell) {
rtext::check_error("exec /bin/sh", do_exec(name, ["/bin/sh"]));
// TODO: respect the user's $SHELL
rtext::check_error("exec /bin/sh", do_exec("sh", ["/bin/sh"]));
} else {
rtext::check_error("exec <user command>", do_exec(name, opts.cmd));
};