diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-07-06 19:06:49 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-07-06 21:02:40 +0900 |
commit | afd4cfcf22a4ec6e2dbd5f774169ce771d22acea (patch) | |
tree | 20d171e23bddc285e7db8fad1fe71d743a2cb963 /tool/lib/colorize.rb | |
parent | 9accb92ba1db93ccb30785e4a637f345569afb4e (diff) | |
download | ruby-afd4cfcf22a4ec6e2dbd5f774169ce771d22acea.tar.gz |
Try "so" attribute if "smso" is not found
Diffstat (limited to 'tool/lib/colorize.rb')
-rw-r--r-- | tool/lib/colorize.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tool/lib/colorize.rb b/tool/lib/colorize.rb index 6699aef572..11b878d318 100644 --- a/tool/lib/colorize.rb +++ b/tool/lib/colorize.rb @@ -8,7 +8,7 @@ class Colorize @colors = @reset = nil @color = (opts[:color] if opts) if color or (color == nil && STDOUT.tty?) - if (/\A\e\[.*m\z/ =~ IO.popen("tput smso", "r", :err => IO::NULL, &:read) rescue nil) + if (%w[smso so].any? {|attr| /\A\e\[.*m\z/ =~ IO.popen("tput #{attr}", "r", :err => IO::NULL, &:read)} rescue nil) @beg = "\e[" colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {} if opts and colors_file = opts[:colors_file] |