Skip to content

Commit 2899621

Browse files
authored
Merge pull request #711 from tpope/missing-term
Restore colors when TERM is unset
2 parents 6610df3 + a8050c8 commit 2899621

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

lib/thor/shell/color.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def can_display_colors?
101101
end
102102

103103
def are_colors_supported?
104-
stdout.tty? && ![nil, "dumb"].include?(ENV["TERM"])
104+
stdout.tty? && ENV["TERM"] != "dumb"
105105
end
106106

107107
def are_colors_disabled?

spec/shell/color_spec.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ def shell
145145
expect(colorless).to eq("hi!")
146146
end
147147

148-
it "does nothing when the TERM environment variable is not set" do
149-
allow(ENV).to receive(:[]).with("TERM").and_return(nil)
150-
colorless = shell.set_color "hi!", :white
151-
expect(colorless).to eq("hi!")
152-
end
153-
154148
it "does nothing when the NO_COLOR environment variable is set" do
155149
allow(ENV).to receive(:[]).with("NO_COLOR").and_return("")
156150
allow($stdout).to receive(:tty?).and_return(true)

0 commit comments

Comments
 (0)