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

Re: multios stripping colors?

Ray Andrews wrote:
>      $   eval "$@"
> That line in a function of mine can successfully eat some very complex 
> input including various pipes and color codes.  However, when I try this:

eval "eats" only shell syntax. Colour codes are eaten by your
terminal. Perhaps you contrived to prevent them being generated or
constructed something to filter them out.

> $ eval "$@" >&2 >! /tmp/_output
> Although I do get both outputs, the screen looses all colorized output 

There is nothing intrinsic to your construct that loses colour escape
sequences. Try the following:

  eval "print -P '%K{blue}Hello'" >&2 >! /tmp/_output      
  cat /tmp/_output 

This should give you a blue background from both commands.

So you might need to take a closer look at exactly what argument you are
passing to eval.

Some commands, make coloured output conditional on whether their
standard output points to a terminal. For an example, try:
  git log | cat


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