changeset 37462:c0d0fd87ba7c

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.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 07 Apr 2018 21:21:03 +0900
parents 538353b80676
children bbd240f81ac5
files mercurial/utils/procutil.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()"""