diff --git a/.github/workflows/artifact.yml b/.github/workflows/artifact.yml index b028a64..65e1a48 100644 --- a/.github/workflows/artifact.yml +++ b/.github/workflows/artifact.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - uses: goto-bus-stop/setup-zig@v2 with: - version: 0.12.0 + version: 0.13.0 - run: | zig build ci --summary all - if: ${{ matrix.os == 'ubuntu-latest' }} diff --git a/.gitignore b/.gitignore index ac8f2ad..b3ac281 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ *~ -zig-cache/ +.zig-cache/ zig-out/ /dep /scratch diff --git a/test.zig b/test.zig index e2e3baa..4a30573 100644 --- a/test.zig +++ b/test.zig @@ -348,7 +348,7 @@ pub fn main() !u8 { // NOTE: this test will eventually break when these builds are cleaned up, // we should support downloading from bazel and use that instead since // it should be more permanent - try runNoCapture(zigup_args ++ &[_][]const u8{ "0.12.0-dev.3639+9cfac4718" }); + try runNoCapture(zigup_args ++ &[_][]const u8{ "0.14.0-dev.14+ec337051a" }); std.log.info("Success", .{}); return 0; @@ -404,7 +404,7 @@ fn trailNl(s: []const u8) []const u8 { return if (s.len == 0 or s[s.len - 1] != '\n') "\n" else ""; } -fn dumpExecResult(result: std.ChildProcess.RunResult) void { +fn dumpExecResult(result: std.process.Child.RunResult) void { if (result.stdout.len > 0) { std.debug.print("--- STDOUT ---\n{s}{s}--------------\n", .{ result.stdout, trailNl(result.stdout) }); } @@ -420,28 +420,28 @@ fn runNoCapture(argv: []const []const u8) !void { dumpExecResult(result); try passOrThrow(result.term); } -fn runCaptureOuts(allocator: std.mem.Allocator, argv: []const []const u8) !std.ChildProcess.RunResult { +fn runCaptureOuts(allocator: std.mem.Allocator, argv: []const []const u8) !std.process.Child.RunResult { { const cmd = try std.mem.join(allocator, " ", argv); defer allocator.free(cmd); std.log.info("RUN: {s}", .{cmd}); } - return try std.ChildProcess.run(.{ .allocator = allocator, .argv = argv, .env_map = &child_env_map }); + return try std.process.Child.run(.{ .allocator = allocator, .argv = argv, .env_map = &child_env_map }); } -fn passOrThrow(term: std.ChildProcess.Term) error{ChildProcessFailed}!void { +fn passOrThrow(term: std.process.Child.Term) error{ChildProcessFailed}!void { if (!execResultPassed(term)) { std.log.err("child process failed with {}", .{term}); return error.ChildProcessFailed; } } -fn passOrDumpAndThrow(result: std.ChildProcess.RunResult) error{ChildProcessFailed}!void { +fn passOrDumpAndThrow(result: std.process.Child.RunResult) error{ChildProcessFailed}!void { if (!execResultPassed(result.term)) { dumpExecResult(result); std.log.err("child process failed with {}", .{result.term}); return error.ChildProcessFailed; } } -fn execResultPassed(term: std.ChildProcess.Term) bool { +fn execResultPassed(term: std.process.Child.Term) bool { switch (term) { .Exited => |code| return code == 0, else => return false, diff --git a/win32exelink.zig b/win32exelink.zig index e960c22..2e6f8f9 100644 --- a/win32exelink.zig +++ b/win32exelink.zig @@ -13,7 +13,7 @@ export var zig_exe_string: [exe_marker_len + std.fs.MAX_PATH_BYTES + 1]u8 = ("!!!THIS MARKS THE zig_exe_string MEMORY!!#" ++ ([1]u8{0} ** (std.fs.MAX_PATH_BYTES + 1))).*; const global = struct { - var child: std.ChildProcess = undefined; + var child: std.process.Child = undefined; var arena_instance = std.heap.ArenaAllocator.init(std.heap.page_allocator); const arena = arena_instance.allocator(); }; @@ -42,8 +42,8 @@ pub fn main() !u8 { } args[0] = zig_exe; - // NOTE: create the ChildProcess before calling SetConsoleCtrlHandler because it uses it - global.child = std.ChildProcess.init(args, global.arena); + // NOTE: create the process.child before calling SetConsoleCtrlHandler because it uses it + global.child = std.process.Child.init(args, global.arena); if (0 == win32.SetConsoleCtrlHandler(consoleCtrlHandler, 1)) { log.err("SetConsoleCtrlHandler failed, error={}", .{win32.GetLastError()}); diff --git a/zigup.zig b/zigup.zig index 8f30d85..7f11172 100644 --- a/zigup.zig +++ b/zigup.zig @@ -387,7 +387,7 @@ pub fn runCompiler(allocator: Allocator, args: []const []const u8) !u8 { try argv.appendSlice(args[1..]); // TODO: use "execve" if on linux - var proc = std.ChildProcess.init(argv.items, allocator); + var proc = std.process.Child.init(argv.items, allocator); const ret_val = try proc.spawnAndWait(); switch (ret_val) { .Exited => |code| return code, @@ -1038,9 +1038,9 @@ fn installCompiler(allocator: Allocator, compiler_dir: []const u8, url: []const try loggyRenameAbsolute(installing_dir, compiler_dir); } -pub fn run(allocator: Allocator, argv: []const []const u8) !std.ChildProcess.Term { +pub fn run(allocator: Allocator, argv: []const []const u8) !std.process.Child.Term { try logRun(allocator, argv); - var proc = std.ChildProcess.init(argv, allocator); + var proc = std.process.Child.init(argv, allocator); return proc.spawnAndWait(); }