diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-07-14 21:38:55 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-07-14 21:38:55 -0700 |
| commit | f6c1b71c220406d60ca4bdf9c949e775f7fca466 (patch) | |
| tree | a7984a9aeb0639c6ad604e3c954f7b3b7db99af5 /lib/std/Build/Step.zig | |
| parent | f33395ce6a66df517c09037c4a4f1756ef7f6f2e (diff) | |
| download | zig-f6c1b71c220406d60ca4bdf9c949e775f7fca466.tar.gz zig-f6c1b71c220406d60ca4bdf9c949e775f7fca466.zip | |
build system: update std.Progress.Node for long-lived children
Diffstat (limited to 'lib/std/Build/Step.zig')
| -rw-r--r-- | lib/std/Build/Step.zig | 5 |
1 files changed, 5 insertions, 0 deletions
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(), |
