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

Re: status and pipestatus



In case anyone with the same question finds this thread in the future,
here's how I believe status and pipestatus behave.

Every time pipestatus is updated, status is also updated. Most of the
time when status is updated, pipestatus is also updated, but there are
exceptions. In general, it's not possible to determine whether status
has been updated after the last pipestatus update but by hooking
preexec and zle-line-end it's possible to do this almost all the time.

The reason I've started digging into this is that I'm maintaining ZSH
code that shows status of the last command in the prompt. If the last
command was a pipeline, it shows status for every command in it. Or it
should. I noticed that sometimes it shows pipestatus not from the last
command and went down the rabbit hole. If you are defining your own
prompt, don't attempt to provide this feature as it doesn't seem
possible to do so reliably.

Roman.



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