authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-14 21:38:55-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-14 21:38:55-07:00
logf6c1b71c220406d60ca4bdf9c949e775f7fca466
treea7984a9aeb0639c6ad604e3c954f7b3b7db99af5
parentf33395ce6a66df517c09037c4a4f1756ef7f6f2e

build system: update std.Progress.Node for long-lived children


1 files changed, 5 insertions(+), 0 deletions(-)

lib/std/Build/Step.zig+5
......@@ -361,6 +361,7 @@ pub fn addError(step: *Step, comptime fmt: []const u8, args: anytype) error{OutO
361361pub const ZigProcess = struct {
362362 child: std.process.Child,
363363 poller: std.io.Poller(StreamEnum),
364 progress_ipc_fd: if (std.Progress.have_ipc) ?std.posix.fd_t else void,
364365
365366 pub const StreamEnum = enum { stdout, stderr };
366367};
......@@ -375,6 +376,7 @@ pub fn evalZigProcess(
375376) !?[]const u8 {
376377 if (s.getZigProcess()) |zp| {
377378 assert(watch);
379 if (std.Progress.have_ipc) if (zp.progress_ipc_fd) |fd| prog_node.setIpcFd(fd);
378380 return zigProcessUpdate(s, zp, watch);
379381 }
380382 assert(argv.len != 0);
......@@ -404,6 +406,7 @@ pub fn evalZigProcess(
404406 .stdout = child.stdout.?,
405407 .stderr = child.stderr.?,
406408 }),
409 .progress_ipc_fd = if (std.Progress.have_ipc) child.progress_node.getIpcFd() else {},
407410 };
408411 if (watch) s.setZigProcess(zp);
409412 defer if (!watch) zp.poller.deinit();
......@@ -435,6 +438,8 @@ pub fn evalZigProcess(
435438 try handleChildProcessTerm(s, term, null, argv);
436439 }
437440
441 // This is intentionally printed for failure on the first build but not for
442 // subsequent rebuilds.
438443 if (s.result_error_bundle.errorMessageCount() > 0) {
439444 return s.fail("the following command failed with {d} compilation errors:\n{s}", .{
440445 s.result_error_bundle.errorMessageCount(),