Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 500

Summary: emerge output should not be coloured when redirected
Product: Gentoo Linux Reporter: Arcady Genkin <agenkin-gentoo-bugzilla>
Component: Current packagesAssignee: Geert Bevin <gbevin>
Status: RESOLVED DUPLICATE    
Severity: minor CC: agenkin-gentoo-bugzilla
Priority: High    
Version: unspecified   
Hardware: x86   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Arcady Genkin 2002-02-02 13:00:49 UTC
It would be nice if emerge would not output color escape sequences when 
redirected to a pipe or a file.  Assuming that Python allows to check the type 
of the file descriptor, of course.

It's unnerving to see the "junk" when piping the output to `less', for 
example. ;^)
Comment 1 Chad Huneycutt (RETIRED) gentoo-dev 2002-02-02 18:45:29 UTC
I think 'less -r' (which should be the default in newer baselayouts) will do
what you want.  For other cases, if there is not already, we should probably
provide an option to emerge that disables color (like keychain).
Comment 2 Arcady Genkin 2002-02-02 22:56:29 UTC
"less -r" does what you say, but my main point was that whenever the output goes
to anything other than a terminal, the color escapes are, probably, not
welcome.  So, if there is a way to detect what sort of a file descriptor the
stdout is, the output should not be coloured unless it is a tty.
Comment 3 Geert Bevin 2002-02-03 16:24:17 UTC
Imho it's not possible to detect this automatically, therefor marking as
duplicate of bug 414

*** This bug has been marked as a duplicate of 414 ***