summaryrefslogtreecommitdiff
path: root/lib/bundler/ui/shell.rb
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-05-23 11:23:53 +1000
committerColby Swandale <colby@taplaboratories.com>2017-05-23 11:26:15 +1000
commitac374e57e6e3da826cedf1508242118ce64a3985 (patch)
treed4b1449a86f54ef11c7ed90211157449aa19a908 /lib/bundler/ui/shell.rb
parent128d304ae6a43a83ed710ef483c0a5e3e97b4ac5 (diff)
downloadbundler-ac374e57e6e3da826cedf1508242118ce64a3985.tar.gz
remove colors if printing errors to stderr without a tty available
Diffstat (limited to 'lib/bundler/ui/shell.rb')
-rw-r--r--lib/bundler/ui/shell.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 81743ede40..5d4fd76acb 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -9,7 +9,7 @@ module Bundler
attr_writer :shell
def initialize(options = {})
- if options["no-color"] || !STDOUT.tty?
+ if options["no-color"] || !$stdout.tty?
Thor::Base.shell = Thor::Shell::Basic
end
@shell = Thor::Base.shell.new
@@ -108,6 +108,8 @@ module Bundler
newline = message.to_s !~ /( |\t)\Z/ unless newline
message = word_wrap(message) if newline.is_a?(Hash) && newline[:wrap]
+ color = nil if color && !$stderr.tty?
+
buffer = @shell.send(:prepare_message, message, *color)
buffer << "\n" if newline && !message.to_s.end_with?("\n")