Try "so" attribute if "smso" is not found

This commit is contained in:
Nobuyoshi Nakada 2021-07-06 19:06:49 +09:00
Родитель 9accb92ba1
Коммит afd4cfcf22
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7CD2805BFA3770C6
2 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -8,7 +8,7 @@ class Colorize
@colors = @reset = nil @colors = @reset = nil
@color = (opts[:color] if opts) @color = (opts[:color] if opts)
if color or (color == nil && STDOUT.tty?) 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[" @beg = "\e["
colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {} colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
if opts and colors_file = opts[:colors_file] if opts and colors_file = opts[:colors_file]

Просмотреть файл

@ -9,6 +9,7 @@ AC_DEFUN([_COLORIZE_RESULT_PREPARE], [
[configure_tty=0])]) [configure_tty=0])])
AS_IF([test $configure_tty -eq 1], [ AS_IF([test $configure_tty -eq 1], [
msg_begin="`tput smso 2>/dev/null`" msg_begin="`tput smso 2>/dev/null`"
AS_IF([test -z "$msg_begin"], [msg_begin="`tput so 2>/dev/null`"])
AS_CASE(["$msg_begin"], ['@<:@'*m], AS_CASE(["$msg_begin"], ['@<:@'*m],
[msg_begin="`echo "$msg_begin" | sed ['s/[0-9]*m$//']`" [msg_begin="`echo "$msg_begin" | sed ['s/[0-9]*m$//']`"
msg_checking="${msg_begin}33m" msg_checking="${msg_begin}33m"