Re: git fails with a broken pipe when one quits the pager
- From
- Vincent Lefevre <vincent@vinc17.net>
- Date
- Jan 31, 2021, 03:47 UTC
- Message-ID
- <20210131034754.GL623063@zira.vinc17.org>
- In-Reply-To
- <20210131033652.GK623063@zira.vinc17.org>
On 2021-01-31 04:36:52 +0100, Vincent Lefevre wrote:
Show 26 quoted lines
> On 2021-01-31 02:47:59 +0100, Ævar Arnfjörð Bjarmason wrote:
> > On Fri, Jan 15 2021, Vincent Lefevre wrote:
> > > The broken pipe is internally expected, thus should not be reported
> > > by git.
> > >
> > > Just to be clear: this broken pipe should be discarded only when git
> > > uses its builtin pager feature, not with a general pipe, where the
> > > error may be important.
> > >
> > > For instance,
> > >
> > > $ { git log ; echo "Exit status: $?" >&2 ; } | true
> > >
> > > should still output
> > >
> > > Exit status: 141
> >
> > I don't get it, how is it less meaningful when git itself invokes the
> > pager?
>
> I don't understand your question. If I invoke the pager myself,
> I don't get a SIGPIPE:
>
> cventin:~/software/gcc-trunk> git log
> cventin:~/software/gcc-trunk[PIPE]> git log|m
> cventin:~/software/gcc-trunk>Well, more precisely, I mean that it is not reported. But the SIGPIPE itself still occurs as expected, e.g. for scripts, and one may choose to ignore it or not, as usual.
-- Vincent Lefèvre <vincent@vinc17.net> - 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)