git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edgar Toernig <froese@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC] sending errors to stdout under $PAGER
Date: Sun, 17 Feb 2008 14:48:54 +0100	[thread overview]
Message-ID: <20080217144854.56fcb98d.froese@gmx.de> (raw)
In-Reply-To: <7vbq6g90gy.fsf@gitster.siamese.dyndns.org>

Junio C Hamano wrote:
>
> +	FILE *outto = (pager_in_use() ? stdout : stderr);
> +
>  	vsnprintf(msg, sizeof(msg), err, params);
> -	fprintf(stderr, "%s%s\n", prefix, msg);
> +	fprintf(outto, "%s%s\n", prefix, msg);
>
> What do people think?  Have I overlooked any downsides?

Wouldn't it be better/safer to redirect stderr to the pager
in the first place?

So, instead of the current

	foo | less
use
	foo 2>&1 | less

or, in pager.c:

         /* return in the child */
        if (!pid) {
                dup2(fd[1], 1);
+               dup2(fd[1], 2);
                close(fd[0]);
                close(fd[1]);
                return;
        }

Ciao, ET.

  parent reply	other threads:[~2008-02-17 13:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16 19:15 [RFC] sending errors to stdout under $PAGER Junio C Hamano
2008-02-17  7:50 ` Shawn O. Pearce
2008-02-17 12:35 ` Jeff King
2008-02-17 13:48 ` Edgar Toernig [this message]
2008-02-17 15:15   ` Johannes Schindelin
2008-02-17 17:56   ` Junio C Hamano
2008-02-17 18:15     ` Jeff King
2008-02-17 18:23       ` Junio C Hamano
2008-02-17 19:38         ` Johannes Schindelin

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=20080217144854.56fcb98d.froese@gmx.de \
    --to=froese@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).