From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12371 invoked from network); 2 Jul 2004 21:33:29 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.85) by ns1.primenet.com.au with SMTP; 2 Jul 2004 21:33:29 -0000 Received: (qmail 14416 invoked from network); 2 Jul 2004 22:46:00 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 2 Jul 2004 22:46:00 -0000 Received: (qmail 12960 invoked by alias); 2 Jul 2004 21:32:43 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7662 Received: (qmail 12950 invoked from network); 2 Jul 2004 21:32:43 -0000 Received: from odin.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.85) by sunsite.dk with SMTP; 2 Jul 2004 21:32:43 -0000 Received: (qmail 13286 invoked from network); 2 Jul 2004 22:45:33 -0000 Received: from unknown (HELO moonbase.zanshin.com) (@167.160.213.139) by a.mx.sunsite.dk with SMTP; 2 Jul 2004 22:45:20 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i62LWS8h012076 for ; Fri, 2 Jul 2004 14:32:28 -0700 Date: Fri, 2 Jul 2004 14:32:28 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: coloring STDERR to terminal In-Reply-To: <20040702124259.GS2033@ay.vinc17.org> Message-ID: References: <20040627190433.Q27888@willy_wonka> <20040629160826.GL2033@ay.vinc17.org> <20040630070902.GO2033@ay.vinc17.org> <20040630114341.GR2033@ay.vinc17.org> <20040701181459.GF2033@ay.vinc17.org> <20040702124259.GS2033@ay.vinc17.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 On Fri, 2 Jul 2004, Vincent Lefevre wrote: > Now, in precmd(), adding the following line solves the problem: > > sleep 0 > > Of course, this won't completely avoid the race condition, but it > improves things in pratice. I assume that this forces the scheduler > to switch to another process, and in practice, the coprocess is > scheduled before precmd() is resumed. As sleep is an external command rather than a builtin (cf. zselect), this forces zsh to perform a wait() system call [more or less], which in turn forces the scheduler to let the sleep run to completion before zsh wakes up again. That it's specifically "sleep 0" is probably irrelevant; any external command is likely to have the same effect.