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

Re: coloring STDERR to terminal



Hi everyone,

I'd followed the discussion closely because I also thought coloring of
stderr to be a great thing to have.  I ended up using Vincents way:

>   exec 2>>(while read line; do
>     print '\e[91m'${(q)line}'\e[0m' > /dev/tty; done &)

Which seems to work nicely, well except for the reordering of lines
sometimes, but I could live with that.

However there is one situation where output not only is out of order but
doesn't appear at all:
 condor% echo $ZSH_VERSION
 4.2.0
 condor% touch foo bar
 condor% cp -i foo bar
 cp: overwrite `bar'? y
 condor% exec 2>>(while read line; do print '\e[91m'${(q)line}'\e[0m' > /dev/tty; done &)
 condor% cp -i foo bar                                                                   
 y

As you can see the question doesn't appear at all!
But when I then do this, it suddenly appears:
 condor% echo test >&2
 condor% cp: overwrite `bar'? test

So it seems that zsh doesn't flush some buffer?
Is that a zsh-bug or a problem with this exec-trick?

Chau,
 Andy.

-- 
                              o      _     _         _
  ------- __o       __o      /\_   _ \\o  (_)\__/o  (_)          -o)
  ----- _`\<,_    _`\<,_    _>(_) (_)/<_    \_| \   _|/' \/       /\\
  ---- (_)/ (_)  (_)/ (_)  (_)        (_)   (_)    (_)'  _\o_    _\_v
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 The brain is a wonderful organ; it starts working the moment you get up
 in the morning, and does not stop until you get to work.



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