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

precmd hooks and $?



On Wed, Apr 14, 2021 at 5:06 AM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:

> +prompt_newuser_precmd() {
> +  local exitstatus=$?

It's not documented that precmd hooks can rely on $? to be the exit code
of the last command.  That does work, though (because callhookfunc()
calls doshfunc(noreturnval=1)), and seems useful, and I guess we won't
want to change it, so shall we document it?

It's intentional and as far as I recall has always been assumed, so ... yes.



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