Re: [RFC] sending errors to stdout under $PAGER
- From
- Edgar Toernig <froese@gmx.de>
- Date
- Feb 17, 2008, 13:48 UTC
- Message-ID
- <20080217144854.56fcb98d.froese@gmx.de>
- In-Reply-To
- <7vbq6g90gy.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 8 quoted lines
> > + 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.