From bee8005fe6817ade9191de0493888b14cdbcac31 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 8 Dec 2025 21:00:04 -0800 Subject: std.heap.DebugAllocator: never detect TTY config instead, allow the user to set it as a field. this fixes a bug where leak printing and error printing would run tty config detection for stderr, and then emit a log, which is not necessary going to print to stderr. however, the nice defaults are gone; the user must explicitly assign the tty_config field during initialization or else the logging will not have color. related: https://github.com/ziglang/zig/issues/24510 --- lib/std/debug.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/std/debug.zig') diff --git a/lib/std/debug.zig b/lib/std/debug.zig index cb79bb7855..8f1cd50e8e 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -286,11 +286,13 @@ pub fn unlockStdErr() void { pub fn lockStderrWriter(buffer: []u8) struct { *Writer, tty.Config } { const global = struct { var conf: ?tty.Config = null; + var single_threaded_io: Io.Threaded = .init_single_threaded; }; + const io = global.single_threaded_io.io(); const w = std.Progress.lockStderrWriter(buffer); // The stderr lock also locks access to `global.conf`. if (global.conf == null) { - global.conf = .detect(.stderr()); + global.conf = .detect(io, .stderr()); } return .{ w, global.conf.? }; } -- cgit v1.2.3