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

Re: PROMPT_SP bug with local in precmd



On Fri, 26 Nov 2010 09:38:10 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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. I hope I'm not undoing any magic with this.

Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.249
diff -p -u -r1.249 utils.c
--- Src/utils.c	26 Nov 2010 18:50:22 -0000	1.249
+++ Src/utils.c	26 Nov 2010 22:48:46 -0000
@@ -1293,6 +1293,7 @@ preprompt(void)
 	opts[PROMPTPERCENT] = percents;
 	zputs(str, shout);
 	fprintf(shout, "%*s\r%*s\r", (int)columns - w - !hasxn, "", w, "");
+	fflush(shout);
 	free(str);
     }
 
-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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