diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-04 17:23:57 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-06-04 17:26:23 +0900 |
commit | b0c35ff2db3a4ebb12a405705592e938f50bff64 (patch) | |
tree | 1132b691f1252a43d10a727de7f5423c921c7184 /tool/colorize.rb | |
parent | 16cb1fb007a9d107b8c447e862c92c682a56a7c8 (diff) | |
download | ruby-b0c35ff2db3a4ebb12a405705592e938f50bff64.tar.gz |
colorize.rb: fix reading from test/colors
[ci skip]
Diffstat (limited to 'tool/colorize.rb')
-rw-r--r-- | tool/colorize.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tool/colorize.rb b/tool/colorize.rb index 73dd9e52fd..ed79858ba4 100644 --- a/tool/colorize.rb +++ b/tool/colorize.rb @@ -6,13 +6,14 @@ class Colorize if color or (color == nil && STDOUT.tty?) if (/\A\e\[.*m\z/ =~ IO.popen("tput smso", "r", err: IO::NULL, &:read) rescue nil) @beg = "\e[" - @colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {} + colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {} begin File.read(File.join(__dir__, "../test/colors")).scan(/(\w+)=([^:\n]*)/) do |n, c| colors[n] ||= c end - rescue + rescue Errno::ENOENT end + @colors = colors @reset = "#{@beg}m" end end |