From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21777 invoked by alias); 27 Nov 2010 02:28:02 -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: 28461 Received: (qmail 17368 invoked from network); 27 Nov 2010 02:27:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <101126182734.ZM27122@torch.brasslantern.com> Date: Fri, 26 Nov 2010 18:27:34 -0800 In-reply-to: <20101126225316.325fa5ca@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "Re: PROMPT_SP bug with local in precmd" (Nov 26, 10:53pm) References: <20101126115148.GT1254@prunille.vinc17.org> <101126093810.ZM25915@torch.brasslantern.com> <20101126225316.325fa5ca@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: PROMPT_SP bug with local in precmd MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Nov 26, 10:53pm, Peter Stephenson wrote: } Subject: Re: PROMPT_SP bug with local in precmd } } On Fri, 26 Nov 2010 09:38:10 -0800 } Bart Schaefer wrote: } > My conclusion from this is that "foozsh: exit 1" is what you really } > ought to be seeing all the time, and "zsh: exit 1" on its own line is a } > side-effect of a stdio buffer never having been flushed. } } I think the following demonstrates the opposite, i.e. the exit message } now always appears on a newline but as it's race prone it's hard } to be sure. Hmm. Now I get: torch% setopt printexitvalue torch% echo -n foo; false foo% zsh: exit 1 torch% precmd() { /bin/echo -n Hi } torch% torch% echo -n foo; false foo% zsh: exit 1 Hizsh: exit 1 torch% Note that immediately after creating the precmd function, the "Hi" is NOT visible. (This is with Wayne's hasxn patch as well as with your fflush). However, it *was* output -- the prompt just backed up and trod over it. So PROMPT_SP kicks in before precmd does, which is I think what Wayne asserted it should do. However with a non-builtin command in the precmd, I'm still getting "zsh: exit 1" printed twice, so I think we're both correct -- that is, there's *another* place where a fflush() is needed. Looks like just after line 3188 in Src/exec.c. With fflush() added there as well, I consistently get this: torch% setopt printexitvalue torch% echo -n foo; false foozsh: exit 1 torch% precmd() { /bin/echo -n Hi } torch% echo -n foo; false foozsh: exit 1 torch% Note there's now only one "zsh: exit 1" and the prompt now consistently covers up the output from precmd. } I hope I'm not undoing any magic with this. Ditto.