dispatch: exit with 8-bit exit code
authorMads Kiilerich <mads@kiilerich.com>
Mon, 07 Nov 2011 03:14:53 +0100
changeset 15439 01611e7c36ff
parent 15438 4d5b12a5517b
child 15440 9ab2b3b730ee
dispatch: exit with 8-bit exit code The exit code returned from a program to the shell is unsigned 8-bit, but Mercurial would sometimes try to exit with negative numbers or None. sys.exit on Unix will convert that to 8-bit exit codes, but on Windows negative values showed up as 0. The exit code is now explicitly converted to unsigned 8-bit.
mercurial/dispatch.py
--- a/mercurial/dispatch.py	Mon Nov 07 03:14:53 2011 +0100
+++ b/mercurial/dispatch.py	Mon Nov 07 03:14:53 2011 +0100
@@ -24,7 +24,7 @@
 
 def run():
     "run the command in sys.argv"
-    sys.exit(dispatch(request(sys.argv[1:])))
+    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
 
 def dispatch(req):
     "run the command specified in req.args"