From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1335 invoked by alias); 22 Jan 2016 01:42:31 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37728 Received: (qmail 23954 invoked from network); 22 Jan 2016 01:42:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.0 Date: Fri, 22 Jan 2016 02:42:29 +0100 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: prompt update and TRAPCHLD Message-ID: <20160122014229.GB26912@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20160114171631.GC12351@cventin.lip.ens-lyon.fr> <160114185941.ZM18307@torch.brasslantern.com> <20160121135120.GC21104@cventin.lip.ens-lyon.fr> <160121111355.ZM25640@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <160121111355.ZM25640@torch.brasslantern.com> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.24-6551-vl-r83103 (2016-01-05) On 2016-01-21 11:13:55 -0800, Bart Schaefer wrote: > The rule actually is that traps are executed as early as it is "safe" to > do so (memory management, etc.), and one of those times is immediately > before another command is going to be run; so the trap could execute for > example at any time during your precmd function, or during zle-line-init, > etc. > > So in that sense yes, there is a race condition. The following code solves it: updprompt() { unset _trapchld_called [...] [[ -n $_trapchld_called ]] && updprompt } TRAPCHLD() { if [[ -o interactive && -n $TTY ]] then { updprompt typeset -g _trapchld_called=1 } fi } -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)