From f6c1b71c220406d60ca4bdf9c949e775f7fca466 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 14 Jul 2024 21:38:55 -0700 Subject: [PATCH] build system: update std.Progress.Node for long-lived children --- lib/std/Build/Step.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index 397ad6c55f..fc40a680c4 100644 --- a/lib/std/Build/Step.zig +++ b/lib/std/Build/Step.zig @@ -361,6 +361,7 @@ pub fn addError(step: *Step, comptime fmt: []const u8, args: anytype) error{OutO pub const ZigProcess = struct { child: std.process.Child, poller: std.io.Poller(StreamEnum), + progress_ipc_fd: if (std.Progress.have_ipc) ?std.posix.fd_t else void, pub const StreamEnum = enum { stdout, stderr }; }; @@ -375,6 +376,7 @@ pub fn evalZigProcess( ) !?[]const u8 { if (s.getZigProcess()) |zp| { assert(watch); + if (std.Progress.have_ipc) if (zp.progress_ipc_fd) |fd| prog_node.setIpcFd(fd); return zigProcessUpdate(s, zp, watch); } assert(argv.len != 0); @@ -404,6 +406,7 @@ pub fn evalZigProcess( .stdout = child.stdout.?, .stderr = child.stderr.?, }), + .progress_ipc_fd = if (std.Progress.have_ipc) child.progress_node.getIpcFd() else {}, }; if (watch) s.setZigProcess(zp); defer if (!watch) zp.poller.deinit(); @@ -435,6 +438,8 @@ pub fn evalZigProcess( try handleChildProcessTerm(s, term, null, argv); } + // This is intentionally printed for failure on the first build but not for + // subsequent rebuilds. if (s.result_error_bundle.errorMessageCount() > 0) { return s.fail("the following command failed with {d} compilation errors:\n{s}", .{ s.result_error_bundle.errorMessageCount(),