git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "Boyd Stephen Smith Jr." <bss03@volumehost.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: fatal output from git-show really wants a terminal
Date: Thu, 11 Dec 2008 16:55:55 -0500	[thread overview]
Message-ID: <20081211215554.GA11565@sigill.intra.peff.net> (raw)
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

  reply	other threads:[~2008-12-11 21:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-10 16:01 fatal output from git-show really wants a terminal Tim Olsen
2008-12-10 16:10 ` Boyd Stephen Smith Jr.
2008-12-10 19:46 ` Johannes Sixt
2008-12-10 20:10   ` Tim Olsen
2008-12-10 22:24   ` Boyd Stephen Smith Jr.
     [not found]     ` <alpine.DEB.1.00.0812111015140.18321@eeepc-johanness>
2008-12-11 16:51       ` Boyd Stephen Smith Jr.
2008-12-11 21:55         ` Jeff King [this message]
2008-12-11 22:45           ` Boyd Stephen Smith Jr.
2008-12-11 22:59             ` Jeff King
2008-12-11 23:03             ` Junio C Hamano
2008-12-15  8:15               ` Junio C Hamano
2008-12-15  8:23                 ` Junio C Hamano
2008-12-15  8:25                 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081211215554.GA11565@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=bss03@volumehost.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).