zig/lib/std/Io
Matthew Lugg c6b5945356 std.Build: don't force all children to inherit color option
The build runner was previously forcing child processes to have their
stderr colorization match the build runner by setting `CLICOLOR_FORCE`
or `NO_COLOR`. This is a nice idea in some cases---for instance a simple
`Run` step which we just expect to exit with code 0 and whose stderr is
not being programmatically inspected---but is a bad idea in others, for
instance if there is a check on stderr or if stderr is captured, in
which case forcing color on the child could cause checks to fail.

Instead, this commit adds a field to `std.Build.Step.Run` which
specifies a behavior for the build runner to employ in terms of
assigning the `CLICOLOR_FORCE` and `NO_COLOR` environment variables. The
default behavior is to set `CLICOLOR_FORCE` if the build runner's output
is colorized and the step's stderr is not captured, and to set
`NO_COLOR` otherwise. Alternatively, colors can be always enabled,
always disabled, always match the build runner, or the environment
variables can be left untouched so they can be manually controlled
through `env_map`.

Notably, this fixes a failure when running `zig build test-cli` in a
TTY (or with colors explicitly enabled). GitHub CI hadn't caught this
because it does not request color, but Codeberg CI now does, and we were
seeing a failure in the `zig init` test because the actual output had
color escape codes in it due to 6d280dc.
2025-11-14 21:50:24 +01:00
..
net std.Io.net: fix off-by-one in HostName.expand 2025-11-13 21:04:21 -08:00
Reader Fix Reader.Limited end of stream conditions 2025-10-08 17:24:38 -07:00
Threaded std.Io: fix calls on functions that return an array type 2025-11-11 01:11:51 +01:00
Dir.zig std.Io: add dirMakePath and dirMakeOpenPath 2025-10-29 06:20:50 -07:00
File.zig Elf2: load archives 2025-10-29 18:07:12 -04:00
IoUring.zig std.Io: adjust concurrent error set 2025-10-29 06:20:51 -07:00
Kqueue.zig std.Io: fix Group.wait unsoundness 2025-10-29 06:20:52 -07:00
net.zig Io.net: set receive{,Timeout} message to init 2025-11-06 17:44:28 -08:00
Reader.zig Fix param name in doc comment for std.Io.Reader.peek() 2025-11-08 00:34:41 -08:00
test.zig Io.Queue: fix empty and full states being indistinguishable. 2025-11-04 04:24:32 -05:00
Threaded.zig represent Mac Catalyst as aarch64-maccatalyst-none rather than aarch64-ios-macabi 2025-11-14 11:33:35 +01:00
tty.zig std.Build: don't force all children to inherit color option 2025-11-14 21:50:24 +01:00
Writer.zig std.Io.Writer.print: support .enum_literal in 't' format specifier 2025-11-06 13:45:21 +08:00