Re: fatal output from git-show really wants a terminal
- From
Jeff King <peff@peff.net>
- Date
- Dec 11, 2008, 21:55 UTC
- Message-ID
- <20081211215554.GA11565@sigill.intra.peff.net>
- In-Reply-To
- <200812111051.20322.bss03@volumehost.net>
On Thu, Dec 11, 2008 at 10:51:15AM -0600, Boyd Stephen Smith Jr. wrote:
> Initially, I was looking for 'stdout' or 'stderr', and found many unrelated > commits. I then figured it was part of the PAGER support, and began
Try looking for isatty, which takes the numeric fd. I think the behavior you asked about would be this:
diff --git a/pager.c b/pager.c index aa0966c..19f8856 100644 --- a/pager.c +++ b/pager.c @@ -42,7 +42,7 @@ void setup_pager(void) { const char *pager = getenv("GIT_PAGER"); - if (!isatty(1)) + if (!isatty(0) || !isatty(2)) return; if (!pager) { if (!pager_program) which is what is mentioned in POSIX: http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html But I don't think that makes sense here. We are not talking about interactivity, but rather about where the output is going. So your test would consider this interactive: $ git log >foo.out and start a pager, which makes no sense. Now if you proposed checking stderr and stdin _in addition_ to stdout, that might make more sense, but I haven't thought too hard about any implications. And FWIW, I don't recall this ever being discussed before, but then I have not been involved with git since the very beginning. -Peff