disable colors if output is not a tty

This commit is contained in:
HoneyryderChuck 2018-03-28 11:00:12 +01:00
parent e36a91b6cc
commit 0da9b26f26

View File

@ -17,7 +17,7 @@ module HTTPX
return unless @options.debug
return unless @options.debug_level >= level
message = (+label << msg.call << "\n")
message = "\e[#{COLORS[color]}m#{message}\e[0m" if color
message = "\e[#{COLORS[color]}m#{message}\e[0m" if color && @options.debug.isatty
@options.debug << message
end
end