Skip to content

Commit

Permalink
Respect NO_COLOR in the compiler (#14260)
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil committed Jan 29, 2024
1 parent 0ff99d9 commit ab96337
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit ab96337

Please sign in to comment.