comparison mercurial/utils/procutil.py @ 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
comparison
equal deleted inserted replaced
37461:538353b80676 37462:c0d0fd87ba7c
81 def explainexit(code): 81 def explainexit(code):
82 """return a 2-tuple (desc, code) describing a subprocess status 82 """return a 2-tuple (desc, code) describing a subprocess status
83 (codes from kill are negative - not os.system/wait encoding)""" 83 (codes from kill are negative - not os.system/wait encoding)"""
84 if code >= 0: 84 if code >= 0:
85 return _("exited with status %d") % code, code 85 return _("exited with status %d") % code, code
86 return _("killed by signal %d") % -code, -code 86 return _("killed by signal %d") % -code, code
87 87
88 class _pfile(object): 88 class _pfile(object):
89 """File-like wrapper for a stream opened by subprocess.Popen()""" 89 """File-like wrapper for a stream opened by subprocess.Popen()"""
90 90
91 def __init__(self, proc, fp): 91 def __init__(self, proc, fp):