From 376320a5e9bfc32162c81b592784e6f54aeae62b Mon Sep 17 00:00:00 2001 From: Brandon Black Date: Wed, 14 Jan 2026 18:15:18 -0600 Subject: [PATCH] Io.Select: do not swallow error.Canceled of task --- lib/std/Io.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/std/Io.zig b/lib/std/Io.zig index 18aa1e127abb1d679439f4ed8e28be01f2d315d7..38ed8c865a0eacee50db950cc707d9e2a32b3bc3 100644 --- a/lib/std/Io.zig +++ b/lib/std/Io.zig @@ -1269,10 +1269,13 @@ pub fn Select(comptime U: type) type { args: @TypeOf(args), fn start(type_erased_context: *const anyopaque) Cancelable!void { const context: *const @This() = @ptrCast(@alignCast(type_erased_context)); - const elem = @unionInit(U, @tagName(field), @call(.auto, function, context.args)); + const raw_result = @call(.auto, function, context.args); + const elem = @unionInit(U, @tagName(field), raw_result); context.select.queue.putOneUncancelable(context.select.io, elem) catch |err| switch (err) { error.Closed => unreachable, }; + if (@typeInfo(@TypeOf(raw_result)) == .error_union) + raw_result catch |err| if (err == error.Canceled) return error.Canceled; } }; const context: Context = .{ .select = s, .args = args }; -- 2.54.0