Files
zig/lib/std
Andrew Kelley ffcbd48a12 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.
2025-12-23 22:15:09 -08:00
..
2025-11-22 22:42:38 +00:00
2025-12-23 22:15:08 -08:00
2025-12-23 22:15:09 -08:00
2025-11-22 22:42:38 +00:00
2025-12-23 22:15:08 -08:00
2025-09-30 13:44:54 +01:00
2025-09-20 14:34:18 -07:00
2024-08-22 08:44:08 +02:00
2025-11-22 22:42:38 +00:00
2025-12-06 22:08:40 +01:00
2025-12-23 22:15:09 -08:00
2025-08-29 17:14:26 -07:00
2025-08-29 17:14:26 -07:00
2025-12-23 22:15:09 -08:00
2025-11-22 22:42:38 +00:00
2025-12-23 22:15:08 -08:00
2025-12-23 22:15:09 -08:00
2025-08-28 18:30:57 -07:00
2025-07-16 10:27:39 -07:00
2025-12-23 22:15:08 -08:00