incoming exit status
Haszlakiewicz, Eric
EHASZLA at transunion.com
Wed Nov 10 21:52:46 UTC 2010
>-----Original Message-----
>From: Jason Harris [mailto:jason at jasonfharris.com]
>
>Well you can just use 'hg --quiet incoming' to ensure you don't have any
>chatty messages... If thats the empty string you don't have any incoming
>changesets. Simple.
X=$(hg --quiet incoming)
if [ -z "$X" ] ; then
...
fi
vs.
hg incoming > /dev/null
if [ $? -eq 1 ] ; then
...
fi
eh, seems about the same to me.
>On Nov 10, 2010, at 8:50 PM, Matt Mackall 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.
>
>(Maybe grep is more of an aberration here than a paragon of consistency
>with the wider world? Are there many other examples of this behavior?
>From what I can tell by googling it appears not... Eg things like ' touch
>bob; wc bob; echo $? ' yields an exit code of 0. As does the unix 'find'
>command when it doesn't find any matches, etc..)
There are lots of programs that use the exit value as more than just a boolean. For instance:
cmp
diff
gzip
ping
just to name a few off the top of my head.
eric
More information about the Mercurial
mailing list