bunpen: execute the given argv

This commit is contained in:
2024-08-22 14:34:08 +00:00
parent 64f53020ee
commit dab7803cbb

View File

@@ -1,6 +1,20 @@
// vim: set shiftwidth=2 :
use fmt;
use strings;
use os;
use os::exec;
fn do_exec(args: []str) never = {
let joined = strings::join(" ", args...);
fmt::printfln("exec: {}", joined)!;
free(joined);
let cmd = os::exec::cmd(args[0], args[1..]...)!;
os::exec::exec(&cmd);
};
export fn main() void = {
fmt::println("Hello world!")!;
let my_name = os::args[0];
let exec_line = os::args[1..];
do_exec(exec_line);
};