Functions from std.os
moved to std.posix
.
Probably what you want is not the unix specific exec
that replaces the current process, but the spawn
, spawnAndWait
, or run
function of std.process.Child
Test Example:
test.zig
const std = @import("std");
test {
const argv = [_][]const u8{ "echo", "Hello", "World" };
var child = std.process.Child.init(&argv, std.testing.allocator);
try child.spawn();
const exit_code = child.wait();
try std.testing.expectEqual(exit_code, std.process.Child.Term{ .Exited = 0 });
}
Run as:
> zig test test.zig
Hello World
All 1 tests passed.