Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix color preference parsing from env #22497

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sno2
Copy link
Contributor

@sno2 sno2 commented Jan 15, 2025

Modifies the preference parsing code to correctly
assert the NO_COLOR environment variable's value
is not an empty string.

Closes #22380.

Modifies the preference parsing code to correctly
assert the NO_COLOR environment variable's value
is not an empty string.

Closes ziglang#22380.
@@ -45,6 +48,20 @@ pub const Color = enum {
/// Assume stderr is a terminal.
on,

pub fn getEnv(arena: std.mem.Allocator) !Color {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like something like getFromEnv would be more appropriate naming-wise

Copy link
Member

@ifreund ifreund left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the proper place to implement this check if the value of a set environment variable is empty would be EnvVar.isSet(), other environment variables such as ZIG_VERBOSE_LINK should have consistent behavior with NO_COLOR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NO_COLOR handling is wrong
3 participants