fatal output from git-show really wants a terminal

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

fatal output from git-show really wants a terminal

From: Tim Olsen <hidden>
Date: 2016-06-15 22:45:45

It appears that when outputting a fatal error, git-show will choose
stdout over stderr if stdout is a terminal and stderr is not.  How do I
redirect the error but still allow stdout to be displayed?

~/git$ mkdir test

~/git$ cd test

~/git/test$ git init

~/git/test$ git show 12345

fatal: ambiguous argument '12345': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions

~/git/test$ git show 12345 2> /dev/null

fatal: ambiguous argument '12345': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions

~/git/test$ git show 12345 > /dev/null

fatal: ambiguous argument '12345': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions

~/git/test$ git show 12345 > /dev/null 2> /dev/null

~/git/test$ git show 12345 > /tmp/out 2> /tmp/err

~/git/test$ cat /tmp/out

~/git/test$ cat /tmp/err

fatal: ambiguous argument '12345': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions

Re: fatal output from git-show really wants a terminal

From: Boyd Stephen Smith Jr. <hidden>
Date: 2016-06-15 22:45:45

On Wednesday 2008 December 10 10:01:49 you wrote:
It appears that when outputting a fatal error, git-show will choose
stdout over stderr if stdout is a terminal and stderr is not.  How do I
redirect the error but still allow stdout to be displayed?
Gah, I think that's really bad behavior. Anyway, something like:
git show 12345 2>/dev/null | cat
should work.  Neither stdout nor stderr will be a terminal, but stdout will be 
displayed to your terminal.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss03@volumehost.net                      ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.org/                      \_/     

Re: fatal output from git-show really wants a terminal

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:45:45

On Mittwoch, 10. Dezember 2008, Tim Olsen wrote:
It appears that when outputting a fatal error, git-show will choose
stdout over stderr if stdout is a terminal and stderr is not.
This is by design.
How do I 
redirect the error but still allow stdout to be displayed?
$ git show 12345 2> /dev/null | less
~/git$ mkdir test
~/git$ cd test
~/git/test$ git init
~/git/test$ git show 12345
fatal: ambiguous argument '12345': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions
You see this through the pager.
~/git/test$ git show 12345 2> /dev/null
fatal: ambiguous argument '12345': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions
And this went through the pager as well.
~/git/test$ git show 12345 > /dev/null
fatal: ambiguous argument '12345': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions
This went straight to the terminal.

The pattern is that if stdout is a terminal, the pager is thrown up and both 
stdout and stderr of git show proper are redirected to the pager. If you 
redirect only stderr, then this redirection is actually ignored.

-- Hannes

Re: fatal output from git-show really wants a terminal

From: Tim Olsen <hidden>
Date: 2016-06-15 22:45:45

Johannes Sixt wrote:
The pattern is that if stdout is a terminal, the pager is thrown up and both 
stdout and stderr of git show proper are redirected to the pager. If you 
redirect only stderr, then this redirection is actually ignored.
I see.  So I probably want to use --no-pager.

Thanks for the help.

-Tim
-- Hannes

Re: fatal output from git-show really wants a terminal

From: Boyd Stephen Smith Jr. <hidden>
Date: 2016-06-15 22:45:45

On Wednesday 2008 December 10 13:46:50 you wrote:
On Mittwoch, 10. Dezember 2008, Tim Olsen wrote:
quoted
It appears that when outputting a fatal error, git-show will choose
stdout over stderr if stdout is a terminal and stderr is not.
This is by design.
Then it is poor design. :P j/k

Why not use the pager only if git-show is "interactive", using the same test 
for interactivity as SUSv3/POSIX shells use?  IIRC, a shell is interactive if 
both stdin and stderr are terminals.  That test for interactivity -- a 
associated difference in behavior -- predates git by a number of years.  Is 
there a reason for being different?  Is the porcelain consistent about that 
behavior?
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss03@volumehost.net                      ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.org/                      \_/     
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help