comparison mercurial/posix.py @ 37460:a6c6b7beb025

procutil: unify platform.explainexit() Since 4368f582c806 "use subprocess instead of os.system", posix.explainexit() is the superset of Windows implementation.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 07 Apr 2018 21:14:16 +0900
parents 90c5ca718781
children 2d919ab6c5b4
comparison
equal deleted inserted replaced
37459:90c5ca718781 37460:a6c6b7beb025
477 os.kill(pid, 0) 477 os.kill(pid, 0)
478 return True 478 return True
479 except OSError as inst: 479 except OSError as inst:
480 return inst.errno != errno.ESRCH 480 return inst.errno != errno.ESRCH
481 481
482 def explainexit(code):
483 """return a 2-tuple (desc, code) describing a subprocess status
484 (codes from kill are negative - not os.system/wait encoding)"""
485 if code >= 0:
486 return _("exited with status %d") % code, code
487 return _("killed by signal %d") % -code, -code
488
489 def isowner(st): 482 def isowner(st):
490 """Return True if the stat object st is from the current user.""" 483 """Return True if the stat object st is from the current user."""
491 return st.st_uid == os.getuid() 484 return st.st_uid == os.getuid()
492 485
493 def findexe(command): 486 def findexe(command):