From: "Shawn O. Pearce" <spearce@spearce•org>
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 02:50:33 -0500 [thread overview]
Message-ID: <20080217075033.GP24004@spearce.org> (raw)
In-Reply-To: <7vbq6g90gy.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox•com> wrote:
> Because we spawn the pager as the foreground process and feed
> its input via pipe from the real command, we cannot affect the
> exit status the shell sees from git command when the pager is in
> use (I think there is not much gain we can have by working it
> around, though). But at least it may make sense to show the
> error message to the user sitting in front of the pager, perhaps
> like this.
>
> What do people think? Have I overlooked any downsides?
I think this is a good idea.
If you are using an interactive pager, you have asked for the content
to come to you through that. Not unlike how I have chosen to have
the content come to me through a virtual pty and not a printer with
green-and-white bar paper. :)
I've been bitten by this in the past a few times, but I have also
been knowledgable enough about git, the command I ran, and the
project I ran it on to realize something wasn't right with the
output I am seeing in the pager and retry without the pager to see
the real error(s).
> +++ b/usage.c
> @@ -4,12 +4,15 @@
> * Copyright (C) Linus Torvalds, 2005
> */
> #include "git-compat-util.h"
> +#include "cache.h"
>
> static void report(const char *prefix, const char *err, va_list params)
> {
> char msg[256];
> + 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);
> }
--
Shawn.
next prev parent reply other threads:[~2008-02-17 7:51 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 [this message]
2008-02-17 12:35 ` Jeff King
2008-02-17 13:48 ` Edgar Toernig
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=20080217075033.GP24004@spearce.org \
--to=spearce@spearce$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
--cc=gitster@pobox$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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