aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-09 22:10:12 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:09 -0800
commitffcbd48a1220ce6d652ee762001d88baa385de49 (patch)
treee1ea279b4cd0b8991df04d8a799589f72dbffd86 /src
parent78d262d96ee6200c7a6bc0a41fe536d263c24d92 (diff)
downloadzig-ffcbd48a1220ce6d652ee762001d88baa385de49.tar.gz
zig-ffcbd48a1220ce6d652ee762001d88baa385de49.zip
std: rework TTY detection and printing
This commit sketches an idea for how to deal with detection of file streams as being terminals. When a File stream is a terminal, writes through the stream should have their escapes stripped unless the programmer explicitly enables terminal escapes. Furthermore, the programmer needs a convenient API for intentionally outputting escapes into the stream. In particular it should be possible to set colors that are silently discarded when the stream is not a terminal. This commit makes `Io.File.Writer` track the terminal mode in the already-existing `mode` field, making it the appropriate place to implement escape stripping. `Io.lockStderrWriter` returns a `*Io.File.Writer` with terminal detection already done by default. This is a higher-level application layer stream for writing to stderr. Meanwhile, `std.debug.lockStderrWriter` also returns a `*Io.File.Writer` but a lower-level one that is hard-coded to use a static single-threaded `std.Io.Threaded` instance. This is the same instance that is used for collecting debug information and iterating the unwind info.
Diffstat (limited to 'src')
-rw-r--r--src/main.zig2
1 files changed, 0 insertions, 2 deletions
diff --git a/src/main.zig b/src/main.zig
index bb940a1fe7..2eebb6d060 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -247,8 +247,6 @@ fn mainArgs(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
threaded.stack_size = thread_stack_size;
const io = threaded.io();
- debug_allocator.tty_config = .detect(io, .stderr());
-
const cmd = args[1];
const cmd_args = args[2..];
if (mem.eql(u8, cmd, "build-exe")) {