Re: git-diff should not fire up $PAGER if there is no diff
- From
Stefan Karpinski <stefan.karpinski@gmail.com>
- Date
- Dec 16, 2008, 06:35 UTC
- Message-ID
- <d4bc1a2a0812152235l14ec80bbr130a7ab152ad6b8@mail.gmail.com>
- In-Reply-To
- <20081216005658.GB3679@coredump.intra.peff.net>
Show 7 quoted lines
> On Mon, Dec 15, 2008 at 7:56 PM, Jeff King <peff@peff.net> wrote: > 2. detect EOF before starting the pager. We in fact already delay > running the pager in the forked process until we have some activity > on the pipe, but I don't know if there is a portable way of > detecting that that activity is EOF without performing an actual > read() call (which is undesirable, since it eats the first byte of > output that should go to the pager).
Wouldn't ungetc work? Or is that not portable enough? (It would only work here because the EOF has to be the first character.)