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(...@@ -1385,14 +1385,12 @@ fn runCommand(
1385 break :term spawnChildAndCollect(run, interp_argv.items, &environ_map, has_side_effects, options, fuzz_context) catch |e| {1385 break :term spawnChildAndCollect(run, interp_argv.items, &environ_map, has_side_effects, options, fuzz_context) catch |e| {
1386 if (!run.failing_to_execute_foreign_is_an_error) return error.MakeSkipped;1386 if (!run.failing_to_execute_foreign_is_an_error) return error.MakeSkipped;
1387 if (e == error.MakeFailed) return error.MakeFailed; // error already reported1387 if (e == error.MakeFailed) return error.MakeFailed; // error already reported
1388 return step.fail("unable to spawn interpreter {s}: {s}", .{1388 return step.fail("unable to spawn interpreter {s}: {t}", .{ interp_argv.items[0], e });
1389 interp_argv.items[0], @errorName(e),
1390 });
1391 };1389 };
1392 }1390 }
1393 if (err == error.MakeFailed) return error.MakeFailed; // error already reported1391 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 });
1396 };1394 };
13971395
1398 const generic_result = opt_generic_result orelse {1396 const generic_result = opt_generic_result orelse {
lib/std/Io/File/MultiReader.zig+6-4
...@@ -17,7 +17,8 @@ pub const Context = struct {...@@ -17,7 +17,8 @@ pub const Context = struct {
17 err: ?Error,17 err: ?Error,
18};18};
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
22/// Trailing:23/// Trailing:
23/// * `contexts: [len]Context`24/// * `contexts: [len]Context`
...@@ -126,13 +127,14 @@ pub fn reader(mr: *MultiReader, index: usize) *Io.Reader {...@@ -126,13 +127,14 @@ pub fn reader(mr: *MultiReader, index: usize) *Io.Reader {
126}127}
127128
128/// Checks for errors in all streams, prioritizing `error.Canceled` if it129/// Checks for errors in all streams, prioritizing `error.Canceled` if it
129/// occurred anywhere.130/// occurred anywhere, and ignoring `error.EndOfStream`.
130pub fn checkAnyError(mr: *const MultiReader) Error!void {131pub fn checkAnyError(mr: *const MultiReader) UnendingError!void {
131 const contexts = mr.streams.contexts();132 const contexts = mr.streams.contexts();
132 var other: Error!void = {};133 var other: UnendingError!void = {};
133 for (contexts) |*context| {134 for (contexts) |*context| {
134 if (context.err) |err| switch (err) {135 if (context.err) |err| switch (err) {
135 error.Canceled => |e| return e,136 error.Canceled => |e| return e,
137 error.EndOfStream => continue,
136 else => |e| other = e,138 else => |e| other = e,
137 };139 };
138 }140 }