[PATCH 3 of 4] hg-ssh: exit with 255 instead of -1 on error

Mads Kiilerich mads at kiilerich.com
Sun May 6 18:01:32 CDT 2012


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1336344728 -7200
# Branch stable
# Node ID ab62cd3f27f64ee1f185ba5dcf4a0938f6f710d1
# Parent  b29cf69ee43da5f673b0b7527d19db14c2b34127
hg-ssh: exit with 255 instead of -1 on error

Unix sh would cast -1 to 255 anyway, but on windows -1 become 0. Better be
explicit with the 255 everywhere.

diff --git a/contrib/hg-ssh b/contrib/hg-ssh
--- a/contrib/hg-ssh
+++ b/contrib/hg-ssh
@@ -41,7 +41,7 @@
     cmdargv = shlex.split(orig_cmd)
 except ValueError, e:
     sys.stderr.write('Illegal command "%s": %s\n' % (orig_cmd, e))
-    sys.exit(-1)
+    sys.exit(255)
 
 if cmdargv[:2] == ['hg', '-R'] and cmdargv[3:] == ['serve', '--stdio']:
     path = cmdargv[2]
@@ -50,8 +50,8 @@
         dispatch.dispatch(dispatch.request(['-R', repo, 'serve', '--stdio']))
     else:
         sys.stderr.write('Illegal repository "%s"\n' % repo)
-        sys.exit(-1)
+        sys.exit(255)
 else:
     sys.stderr.write('Illegal command "%s"\n' % orig_cmd)
-    sys.exit(-1)
+    sys.exit(255)
 


More information about the Mercurial-devel mailing list