authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-22 15:13:48-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-12-23 22:15:12-08:00
log78c4fcfcd89e80ef70cf4cbb13f5100c84432496
tree42485088a2d1555c154d28f5013f89f4e6297cd0
parent3c2f5adf41f0e75fd5e8f6661891dd7d4fa770a9

std.debug.lockStderr: cancel protection rather than recancel

because we need to return the value

1 files changed, 3 insertions(+), 1 deletions(-)

lib/std/debug.zig+3-1
......@@ -281,8 +281,10 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
281281/// application's chosen `Io` implementation.
282282pub fn lockStderr(buffer: []u8) Io.LockedStderr {
283283 const io = std.options.debug_io;
284 const prev = io.swapCancelProtection(.blocked);
285 defer _ = io.swapCancelProtection(prev);
284286 return io.lockStderr(buffer, null) catch |err| switch (err) {
285 error.Canceled => io.recancel(),
287 error.Canceled => unreachable, // Cancel protection enabled above.
286288 };
287289}
288290