automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automake: tap-driver.sh: cleanup and revival.


From: Mathieu Lirzin
Subject: Re: automake: tap-driver.sh: cleanup and revival.
Date: Wed, 25 Oct 2017 23:16:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Warren Young <address@hidden> writes:

> On Oct 25, 2017, at 2:51 PM, Mathieu Lirzin <address@hidden> wrote:
>> 
>> Warren Young <address@hidden> writes:
>> 
>>> As for the portability of ANSI terminal escape codes, it’s still best
>>> to delegate such things to curses or libraries like it, despite the
>>> near ubiquity of ANSI-family terminal emulators.
>
> I didn’t quite finish that thought: “…because at the very least, you can then 
> say 'TERM=dumb myprogram’ to strip terminal escape codes on an ad hoc basis.”
>
>> Colors are already automatically used when possible [1] and can be
>> disabled with the AM_COLOR_TESTS environment variable.
>
> Right on.
>
> Any reason it doesn’t back that up with “test -t 1”, though?

I think it does.  :-)

Here is a snippet from lib/check.am which handles the detection:

--8<---------------cut here---------------start------------->8---
am__tty_colors_dummy = \
  mgn= red= grn= lgn= blu= brg= std=; \
  am__color_tests=no

am__tty_colors = { \
  $(am__tty_colors_dummy); \
  if test "X$(AM_COLOR_TESTS)" = Xno; then \
    am__color_tests=no; \
  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
    am__color_tests=yes; \
## If stdout is a non-dumb tty, use colors.  If test -t is not supported,
## then this check fails; a conservative approach.  Of course do not
## redirect stdout here, just stderr.
  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
    am__color_tests=yes; \
  fi; \
  if test $$am__color_tests = yes; then \
    red='[0;31m'; \
    grn='[0;32m'; \
    lgn='[1;32m'; \
    blu='[1;34m'; \
    mgn='[0;35m'; \
    brg='[1m'; \
    std='[m'; \
  fi; \
}
--8<---------------cut here---------------end--------------->8---

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37



reply via email to

[Prev in Thread] Current Thread [Next in Thread]