authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-28 00:01:41-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-30 12:10:02-08:00
log4593a0dc2edf8145422f3efdf1c09304046f0d98
tree0c05eee9dce24d22a244a271155ff59c5006db24
parentf69891797a831adfeaccaa352ffc8464f6fc3dbd

std.Io.File.MultiReader: make checkAnyError exclude EndOfStream


2 files changed, 8 insertions(+), 8 deletions(-)

lib/std/Build/Step/Run.zig+2-4
......@@ -1385,14 +1385,12 @@ fn runCommand(
13851385 break :term spawnChildAndCollect(run, interp_argv.items, &environ_map, has_side_effects, options, fuzz_context) catch |e| {
13861386 if (!run.failing_to_execute_foreign_is_an_error) return error.MakeSkipped;
13871387 if (e == error.MakeFailed) return error.MakeFailed; // error already reported
1388 return step.fail("unable to spawn interpreter {s}: {s}", .{
1389 interp_argv.items[0], @errorName(e),
1390 });
1388 return step.fail("unable to spawn interpreter {s}: {t}", .{ interp_argv.items[0], e });
13911389 };
13921390 }
13931391 if (err == error.MakeFailed) return error.MakeFailed; // error already reported
13941392
1395 return step.fail("failed to spawn and capture stdio from {s}: {s}", .{ argv[0], @errorName(err) });
1393 return step.fail("failed to spawn and capture stdio from {s}: {t}", .{ argv[0], err });
13961394 };
13971395
13981396 const generic_result = opt_generic_result orelse {
lib/std/Io/File/MultiReader.zig+6-4
......@@ -17,7 +17,8 @@ pub const Context = struct {
1717 err: ?Error,
1818};
1919
20pub const Error = Allocator.Error || File.ReadStreamingError || Io.ConcurrentError;
20pub const Error = UnendingError || error{EndOfStream};
21pub const UnendingError = Allocator.Error || File.Reader.Error || Io.ConcurrentError;
2122
2223/// Trailing:
2324/// * `contexts: [len]Context`
......@@ -126,13 +127,14 @@ pub fn reader(mr: *MultiReader, index: usize) *Io.Reader {
126127}
127128
128129/// Checks for errors in all streams, prioritizing `error.Canceled` if it
129/// occurred anywhere.
130pub fn checkAnyError(mr: *const MultiReader) Error!void {
130/// occurred anywhere, and ignoring `error.EndOfStream`.
131pub fn checkAnyError(mr: *const MultiReader) UnendingError!void {
131132 const contexts = mr.streams.contexts();
132 var other: Error!void = {};
133 var other: UnendingError!void = {};
133134 for (contexts) |*context| {
134135 if (context.err) |err| switch (err) {
135136 error.Canceled => |e| return e,
137 error.EndOfStream => continue,
136138 else => |e| other = e,
137139 };
138140 }