commit:     9a800fe6ba0176691c81f42ef50dcf37976e74ca
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 26 08:49:06 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Nov 26 08:49:06 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=9a800fe6

q: disable colors for pipes

There's no way to detect whether the output is going to a pager (and
we want color) or to another program (and we don't want color), so
turn off color for all pipes.  This matches standard *nix behavior.

URL: https://bugs.gentoo.org/550556
Reported-by: Toralf Förster <toralf.foerster <AT> gmx.de>

 main.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/main.c b/main.c
index 609ed54..c4b9bcc 100644
--- a/main.c
+++ b/main.c
@@ -1376,12 +1376,9 @@ int main(int argc, char **argv)
        bindtextdomain(argv0, CONFIG_EPREFIX "usr/share/locale");
        textdomain(argv0);
 
-#if 1
        if (fstat(fileno(stdout), &st) != -1)
                if (!isatty(fileno(stdout)))
-                       if (S_ISFIFO(st.st_mode) == 0)
-                               no_colors();
-#endif
+                       no_colors();
        if ((getenv("TERM") == NULL) || (strcmp(getenv("TERM"), "dumb") == 0))
                no_colors();
 

Reply via email to