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

Respect NO_COLOR in the compiler #14260

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/compiler/crystal/command.cr
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Crystal::Command
@compiler : Compiler?

def initialize(@options : Array(String))
@color = ENV["TERM"]? != "dumb"
@color = ENV["TERM"]? != "dumb" && !ENV.has_key?("NO_COLOR")
@error_trace = false
@progress_tracker = ProgressTracker.new
end
Expand Down Expand Up @@ -743,7 +743,7 @@ class Crystal::Command

private def error(msg, exit_code = 1)
# This is for the case where the main command is wrong
@color = false if ARGV.includes?("--no-color") || ENV["TERM"]? == "dumb"
@color = false if ARGV.includes?("--no-color") || ENV["TERM"]? == "dumb" || ENV.has_key?("NO_COLOR")
Crystal.error msg, @color, exit_code: exit_code
end

Expand Down