procutil: do not convert return code of signal exit to positive number (API)
authorYuya Nishihara <yuya@tcha.org>
Sat, 07 Apr 2018 21:21:03 +0900
changeset 37462 c0d0fd87ba7c
parent 37461 538353b80676
child 37463 bbd240f81ac5
procutil: do not convert return code of signal exit to positive number (API) The docstring states that "codes from kill are negative", and it doesn't make sense to make exit/signal code ambiguous. .. api:: ``hook.hook()`` and ``hook.runhooks()`` may return a negative integer to denote that the process was killed by signal.
mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py	Sat Apr 07 21:17:50 2018 +0900
+++ b/mercurial/utils/procutil.py	Sat Apr 07 21:21:03 2018 +0900
@@ -83,7 +83,7 @@
     (codes from kill are negative - not os.system/wait encoding)"""
     if code >= 0:
         return _("exited with status %d") % code, code
-    return _("killed by signal %d") % -code, -code
+    return _("killed by signal %d") % -code, code
 
 class _pfile(object):
     """File-like wrapper for a stream opened by subprocess.Popen()"""