mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
build system: update std.Progress.Node for long-lived children
This commit is contained in:
parent
f33395ce6a
commit
f6c1b71c22
@ -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(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user