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

Re: PROMPT_SP bug with local in precmd



On Nov 26, 12:51pm, Vincent Lefevre wrote:
}
} ypig% precmd() { local v=bar }  
} ypig% echo -n foo; false      
} foozsh: exit 1

It's not "local" that triggers this, it's any command:

torch% precmd() { : }
torch% echo -n foo; false
foozsh: exit 1
torch% precmd() { echo -n Hi }
Hi%
torch% echo -n foo; false
foozsh: exit 1
Hi%
torch% precmd() { /bin/echo -n Hi }
Hi%
torch% echo -n foo; false
foozsh: exit 1
Hi%
zsh: exit 1
torch% 


This makes me suspect it's not so much a bug as a race condition -- when
there is a command in precmd, the order in which the exit values from
children (even fake children) are collected and reported is changed.
Note how "zsh: exit 1" is printed twice when the precmd is a forked
process instead of all builtins.

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.



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