Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: coloring STDERR to terminal

On Tue, 20 Jul 2004, Atom 'Smasher' wrote:

> you raise some intersting issues... and not being much of a C programmer 
> myself i'm not sure how to address them... my logic is that if the 
> coloring of STDOUT, STDERR and echoing STDIN is handled ~internally~ by 
> the shell, then everything else should (FTMP) work itself out.

What you're missing is that the shell is not involved in the processing of 
these streams except insofar as it sets up the file descriptors used by 
the commands it spawns.  All the shell does or can do is start the new 
process and then get out of the way until it is finished.

The exception, in the case of zsh, is multios, where the shell explicitly 
sets up each of those file descriptors to point to a special subprocess 
that copies its single input to its multiple outputs as fast as it can.  

What you're asking for is something to copy multiple inputs to a single 
output, simultaneously adding characters (the color codes) to those inputs 
yet without mixing the result any differently than it would have been 
mixed if the writers of all those inputs had instead written directly to 
that single output.

This is, pretty much by definition, impossible, except (sometimes) at the 
level of a kernel driver.

Messages sorted by: Reverse Date, Date, Thread, Author