Mercurial > hg-stable
changeset 782:cdb9e95b2fab
Provided platform dependent implementations for explain_exit
os.system return code is system dependent.
author | thananck@yahoo.com |
---|---|
date | Wed, 27 Jul 2005 10:18:22 -0800 |
parents | 26f3d353851f |
children | 4b06fc1c0f26 |
files | mercurial/util.py |
diffstat | 1 files changed, 16 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Wed Jul 27 10:05:12 2005 -0800 +++ b/mercurial/util.py Wed Jul 27 10:18:22 2005 -0800 @@ -18,19 +18,6 @@ class CommandError(Exception): pass -def explain_exit(code): - """return a 2-tuple (desc, code) describing a process's status""" - if os.WIFEXITED(code): - val = os.WEXITSTATUS(code) - return "exited with status %d" % val, val - elif os.WIFSIGNALED(code): - val = os.WTERMSIG(code) - return "killed by signal %d" % val, val - elif os.WIFSTOPPED(code): - val = os.WSTOPSIG(code) - return "stopped by signal %d" % val, val - raise ValueError("invalid exit code") - def always(fn): return True def never(fn): return False @@ -166,6 +153,9 @@ makelock = _makelock_file readlock = _readlock_file + def explain_exit(code): + return "exited with status %d" % code, code + else: nulldev = '/dev/null' @@ -205,3 +195,16 @@ return _readlock_file(pathname) else: raise + + def explain_exit(code): + """return a 2-tuple (desc, code) describing a process's status""" + if os.WIFEXITED(code): + val = os.WEXITSTATUS(code) + return "exited with status %d" % val, val + elif os.WIFSIGNALED(code): + val = os.WTERMSIG(code) + return "killed by signal %d" % val, val + elif os.WIFSTOPPED(code): + val = os.STOPSIG(code) + return "stopped by signal %d" % val, val + raise ValueError("invalid exit code")