changeset 15439:01611e7c36ff

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.
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 07 Nov 2011 03:14:53 +0100
parents 4d5b12a5517b
children 9ab2b3b730ee
files mercurial/dispatch.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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"