Re: git fails with a broken pipe when one quits the pager
From: Vincent Lefevre <hidden>
Date: 2021-02-04 15:49:52
On 2021-02-04 01:14:10 +0100, Ævar Arnfjörð Bjarmason wrote:
Have you reported this as a bug to zsh?
I repeat: there is no bug in zsh. It is my choice to output the exit status when it is non-zero because I want to know when the command I've typed fails. This is useful in practice. Ignoring the specific value 141 (corresponding to SIGPIPE) is not a solution because it can be a real failure with some utilities. BTW, the association with a signal like SIGPIPE is just a convention; apart from that, 141 is a non-zero status like others (in particular with programs that have not been written for POSIX). For instance, in any shell: $ sh -c "echo foo; exit 141" foo $ echo $? 141 while no broken pipe is involved here. How would you differentiate such a failure from a broken pipe?
I also tested "hg log", it behaves the same way, although interestingly they cast SIGPIPE to 255 in their exit code.
I get 141, like with git: $ hg log $ echo $? 141 -- Vincent Lefèvre [off-list ref] - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)