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

Re: coloring STDERR to terminal

On Tue, Jul 20, 2004 at 08:15:26PM -0700, Bart Schaefer wrote:
> you can't invoke it blindly/automatically on every spawned command,
> because it will play havoc with any text editor or other fullscreen
> UI.

This works the other way around -- you invoke a shell inside it and it
colors all the stderr I/O of everything the shell runs.  I ran an editor
just fine (vim) from a zsh running under it without any havoc.

> E.g. your sample program always writes stdout first and then stderr, 
> even when both are found to be available by the same call to select().

Yeah, I thought of that too while I was eating.  I have them reversed in
the latest code on my website.  I also enhanced the code to forward the
SIGWINCH signal (so that the shell resizes properly) and I moved some of
the code into functions (to make it easier to read).  It seems to work
adequately in my limited testing, but it's probably not super portable.

Compiling note -- under Linux you need to specify -lutil, like this:

    gcc -o color-my-world color-my-world.c -lutil


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