mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
std.debug.lockStderr: cancel protection rather than recancel
because we need to return the value
This commit is contained in:
+3
-1
@@ -281,8 +281,10 @@ pub const sys_can_stack_trace = switch (builtin.cpu.arch) {
|
||||
/// application's chosen `Io` implementation.
|
||||
pub fn lockStderr(buffer: []u8) Io.LockedStderr {
|
||||
const io = std.options.debug_io;
|
||||
const prev = io.swapCancelProtection(.blocked);
|
||||
defer _ = io.swapCancelProtection(prev);
|
||||
return io.lockStderr(buffer, null) catch |err| switch (err) {
|
||||
error.Canceled => io.recancel(),
|
||||
error.Canceled => unreachable, // Cancel protection enabled above.
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user