aboutsummaryrefslogtreecommitdiffstats
path: root/tool/generic_erb.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/generic_erb.rb')
-rw-r--r--tool/generic_erb.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/tool/generic_erb.rb b/tool/generic_erb.rb
index 149de3b1b9..ac1ef7db40 100644
--- a/tool/generic_erb.rb
+++ b/tool/generic_erb.rb
@@ -24,8 +24,8 @@ end
unchanged = "unchanged"
updated = "updated"
if color or (color == nil && STDOUT.tty?)
- if (/\A(\e\[).*m\z/ =~ IO.popen("tput smso", "r", err: IO::NULL, &:read) rescue nil)
- beg = $1
+ 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]*)/)] : {}
reset = "#{beg}m"
unchanged = "#{beg}#{colors["pass"] || "32;1"}m#{unchanged}#{reset}"