mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/irb] Color.colorable? needs to consider the condition when irb is not loaded
ruby/debug uses `irb/color` selectively:0ac22406bb/lib/debug/color.rb (L4)And in that case, `IRB.conf` won't be defined. So Color.colorable? needs to consider that. This also fixes the Ruby trunk CI.b2cd07e795
This commit is contained in:
parent
44c1316293
commit
7d211c93af
1 changed files with 9 additions and 1 deletions
|
|
@ -77,7 +77,15 @@ module IRB # :nodoc:
|
|||
|
||||
class << self
|
||||
def colorable?
|
||||
$stdout.tty? && (/mswin|mingw/ =~ RUBY_PLATFORM || (ENV.key?('TERM') && ENV['TERM'] != 'dumb')) && IRB.conf.fetch(:USE_COLORIZE, true)
|
||||
supported = $stdout.tty? && (/mswin|mingw/ =~ RUBY_PLATFORM || (ENV.key?('TERM') && ENV['TERM'] != 'dumb'))
|
||||
|
||||
# because ruby/debug also uses irb's color module selectively,
|
||||
# irb won't be activated in that case.
|
||||
if IRB.respond_to?(:conf)
|
||||
supported && IRB.conf.fetch(:USE_COLORIZE, true)
|
||||
else
|
||||
supported
|
||||
end
|
||||
end
|
||||
|
||||
def inspect_colorable?(obj, seen: {}.compare_by_identity)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue