[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.
https://github.com/ruby/irb/commit/b2cd07e795
This commit is contained in:
parent
44c1316293
commit
7d211c93af
@ -77,7 +77,15 @@ module IRB # :nodoc:
|
|||||||
|
|
||||||
class << self
|
class << self
|
||||||
def colorable?
|
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
|
end
|
||||||
|
|
||||||
def inspect_colorable?(obj, seen: {}.compare_by_identity)
|
def inspect_colorable?(obj, seen: {}.compare_by_identity)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user