zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@sunsite.dk
Subject: Re: coloring STDERR to terminal
Date: Tue, 29 Jun 2004 10:14:13 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.60.0406291002300.31134@toltec.zanshin.com> (raw)
In-Reply-To: <20040629160826.GL2033@ay.vinc17.org>

On Tue, 29 Jun 2004, Vincent Lefevre wrote:

> On 2004-06-29 08:43:50 -0700, Bart Schaefer wrote:

> >  coproc while read line; print '\e[91m'${(q)line}'\e[0m' > /dev/tty
> >  exec 2>&p
> 
> It doesn't work very well.

Humph.  Depends on your definition of "very well."  Everything sent to the 
standard error is printed in red, isn't it?

> Normally, if I do a Ctrl-d when there are
> running jobs, I get:
> 
> greux:~>
> zsh: you have running jobs.
> greux:~>

Which is exactly what I get even with the coproc, so there's something 
system-specific going on here (race condition resolved differently by the 
kernel process scheduler, perhaps).

> With the coprocess, I get:
> 
> greux:~>
> greux:~> zsh: you have running jobs.

If you want something fancier, have the coproc print a single byte to its
stdout every time around the read loop, and put something like

 while read -t -p -k 1; do :; done

in the precmd() function to force the main shell to synchronize with the
coproc before it prints the prompt.  However, if you produce more lines of 
output between commands than there are bytes of space in the socket buffer
you'll block the coproc and potentially deadlock everything (which is the
trouble with filtering the output of programs that don't expect to have
their output filtered, but that wasn't the question).


  reply	other threads:[~2004-06-29 17:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27 23:22 Atom 'Smasher'
2004-06-28  0:06 ` ari
2004-06-28  0:36   ` Atom 'Smasher'
2004-06-29 15:43 ` Bart Schaefer
2004-06-29 16:08   ` Vincent Lefevre
2004-06-29 17:14     ` Bart Schaefer [this message]
2004-06-30  7:09       ` Vincent Lefevre
2004-06-30 10:52         ` Bart Schaefer
2004-06-30 11:43           ` Vincent Lefevre
2004-06-30 12:01             ` Vincent Lefevre
2004-06-30 16:56             ` Bart Schaefer
2004-07-01 18:14               ` Vincent Lefevre
2004-07-02  0:11                 ` Bart Schaefer
2004-07-02 12:42                   ` Vincent Lefevre
2004-07-02 21:32                     ` Bart Schaefer
2004-07-20  9:10                     ` Atom 'Smasher'
2004-07-20 16:10                       ` Bart Schaefer
2004-07-20 19:27                         ` Atom 'Smasher'
2004-07-20 21:15                           ` Bart Schaefer
2004-07-20 23:30                             ` Wayne Davison
2004-07-21  3:15                               ` Bart Schaefer
2004-07-21  6:23                                 ` Wayne Davison
2004-07-21  7:30                                   ` Bart Schaefer
2004-07-21 13:19                                   ` Vincent Lefevre
2004-07-30 11:50                     ` Andy Spiegl
2004-07-30 23:44                       ` Vincent Lefevre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.60.0406291002300.31134@toltec.zanshin.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).