aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2022-12-14 20:01:11 -0800
committerAndrew Kelley <andrew@ziglang.org>2022-12-15 03:49:26 -0500
commit88d927a511922efd82c4ec862c8e2aa83df84391 (patch)
tree16449de5465989e1e3f8ae7894b5544cd9491109 /lib/std/builtin.zig
parent83e0e23f8aa2d90495bbf9c3649aa68f7c55c926 (diff)
downloadzig-88d927a511922efd82c4ec862c8e2aa83df84391.tar.gz
zig-88d927a511922efd82c4ec862c8e2aa83df84391.zip
std.debug.TTY: Fix colors not resetting on Windows
This fixes a regression introduced in #12298 where colors would never reset in a Windows console because the attributes would be queried on every `setColor` call, and then try to 'reset' the attributes to what it just queried (i.e. it was essentially doing a complicated no-op on .Reset). This fixes the problem while (I think) keeping with the spirit of the changes in #12298--that is, `TTY.Config` is not specifically tied to stderr like it was before #12298. To that end, detectTTYConfig now takes a `File` and that's what gets used to query the initial attributes to reset to. (for context, before #12298, the first `setColor` call is where the reset attributes would get queried and it would always use stderr to do it)
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index eb1212607d..bf3c3e1ee3 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -51,7 +51,7 @@ pub const StackTrace = struct {
const debug_info = std.debug.getSelfDebugInfo() catch |err| {
return writer.print("\nUnable to print stack trace: Unable to open debug info: {s}\n", .{@errorName(err)});
};
- const tty_config = std.debug.detectTTYConfig();
+ const tty_config = std.debug.detectTTYConfig(std.io.getStdErr());
try writer.writeAll("\n");
std.debug.writeStackTrace(self, writer, arena.allocator(), debug_info, tty_config) catch |err| {
try writer.print("Unable to print stack trace: {s}\n", .{@errorName(err)});