incoming exit status

Matt Mackall mpm at selenic.com
Wed Nov 10 17:14:05 CST 2010


On Wed, 2010-11-10 at 16:39 -0600, Matt Schulte wrote:
> On Wed, Nov 10, 2010 at 1:50 PM, Matt Mackall <mpm at selenic.com> wrote:
> > On Wed, 2010-11-10 at 20:08 +0100, Jason Harris wrote:
> >> Personally, I still feel that a valid command, that has executed in a valid way, returning a valid result of (nothing) should have an exit code of 0.
> >
> > Simply put, you're wrong. The grep command was created on March 3, 1973,
> > so there's decades of historical and standards precedent for giving
> > useful exit codes.
> >
> > There's also now half a decade of precedent _in Mercurial itself_ and
> > people in this very thread have already pointed out that they depend on
> > that behavior.
> 
> To be fair I think you are being a bit harsh.

And I'm being harsh because Jason brought up this canard again even
though we've already had this debate like twice and I've already said
"sorry that's just the way it is, so deal with it."

No incoming changesets is _exactly as much of an error_ for hg incoming
as no matched lines is for grep. Here it is straight from the horse's
mouth, Kernighan and Pike, The Unix Programming Environment, 1984 (pg
140, their first mention of exit status):

"Since many different values can all represent 'false,' the reason for
failure is often encoded in the 'false' exit status. For example, grep
returns 0 if there was a match, 1 if there was no match, and 2 if there
was an error in the pattern or filenames."

Here we have, as Jason puts it, a "valid command, that has executed in a
valid way, returning a valid result of (nothing)" held up as the
canonical example of how to use non-zero exit codes by the authors of
Unix.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial mailing list