Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
Date: Thu, 26 Nov 2015 09:00:02
Message-Id: 1448527746.9a800fe6ba0176691c81f42ef50dcf37976e74ca.vapier@gentoo
1 commit: 9a800fe6ba0176691c81f42ef50dcf37976e74ca
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 26 08:49:06 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 26 08:49:06 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=9a800fe6
7
8 q: disable colors for pipes
9
10 There's no way to detect whether the output is going to a pager (and
11 we want color) or to another program (and we don't want color), so
12 turn off color for all pipes. This matches standard *nix behavior.
13
14 URL: https://bugs.gentoo.org/550556
15 Reported-by: Toralf Förster <toralf.foerster <AT> gmx.de>
16
17 main.c | 5 +----
18 1 file changed, 1 insertion(+), 4 deletions(-)
19
20 diff --git a/main.c b/main.c
21 index 609ed54..c4b9bcc 100644
22 --- a/main.c
23 +++ b/main.c
24 @@ -1376,12 +1376,9 @@ int main(int argc, char **argv)
25 bindtextdomain(argv0, CONFIG_EPREFIX "usr/share/locale");
26 textdomain(argv0);
27
28 -#if 1
29 if (fstat(fileno(stdout), &st) != -1)
30 if (!isatty(fileno(stdout)))
31 - if (S_ISFIFO(st.st_mode) == 0)
32 - no_colors();
33 -#endif
34 + no_colors();
35 if ((getenv("TERM") == NULL) || (strcmp(getenv("TERM"), "dumb") == 0))
36 no_colors();