From: Stefan Karpinski Date: Tue, 16 Dec 2008 06:35:53 GMT Subject: Re: git-diff should not fire up $PAGER if there is no diff Message-ID: In-Reply-To: <20081216005658.GB3679@coredump.intra.peff.net> > On Mon, Dec 15, 2008 at 7:56 PM, Jeff King 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.)