mercurial/dispatch.py
changeset 37995 6f9ac3cb0987
parent 37994 e9c588802529
child 38022 48853a927757
--- a/mercurial/dispatch.py	Fri May 11 21:23:48 2018 -0700
+++ b/mercurial/dispatch.py	Sat May 12 15:33:09 2018 +0900
@@ -87,7 +87,7 @@
     req = request(pycompat.sysargv[1:])
     err = None
     try:
-        status = dispatch(req) or 0
+        status = dispatch(req)
     except error.StdioError as e:
         err = e
         status = -1
@@ -175,7 +175,7 @@
     return ' '.join(procutil.shellquote(a) for a in args)
 
 def dispatch(req):
-    "run the command specified in req.args"
+    """run the command specified in req.args; returns an integer status code"""
     if req.ferr:
         ferr = req.ferr
     elif req.ui:
@@ -208,9 +208,9 @@
 
     msg = _formatargs(req.args)
     starttime = util.timer()
-    ret = None
+    ret = -1
     try:
-        ret = _runcatch(req)
+        ret = _runcatch(req) or 0
     except error.ProgrammingError as inst:
         req.ui.warn(_('** ProgrammingError: %s\n') % inst)
         if inst.hint: