Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [RFC][PATCH] Print the usage string on stdout instead of stderr.

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:48:49

Giuseppe Scrivano venit, vidit, dixit 17.05.2010 14:40:
Michael J Gruber [off-list ref] writes:
quoted
More importantly, callers expect error messages on stderr, such as usage
with wrong arguments. I don't think scripts would call commands with
'-h', and if they do they do so on purpose and can parse stderr, knowing
there is no stdout in this case.
It looks like a workaround to me.  Anyway, if -h is left unchanged then,
I think, --help should be adjusted as well when it doesn't use an
external pager.

These two commands behave differently:

git status --help 2>/dev/null | cat -
git status -h 2>/dev/null | cat -
They also do two very different things. The first one displays the man
page, the second the usage string.
IMO, what should be changed is -h to be uniform with --help, as the it
is the expected output, not an error.
That is not what your patch does.

I'm not opposed to having -h output on stdout. I'm opposed to having
usage error messages on stdout. Currently, both are on stderr, which is
no problem (we're not bound by GNU rules here).

Your patch puts both on stdout, and that is a problem, not only for
several test which could be adjusted, but also for scripters.

A patch which *really* only changes '-h' to use stdout would certainly
not be objected. Actually, most calling sites are probably the "error
case" so that you only need to make sure that the "-h" path get's to use
a different output file descriptor.

Cheers,
Michael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help