diff options
| author | bwarsaw | 2002-04-26 16:25:32 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-04-26 16:25:32 +0000 |
| commit | eaf961a7ee46c269c488c3e08ffaafe42fc6a597 (patch) | |
| tree | af009fdbf3f60b2b736857e08dd06e4a38e6abdb | |
| parent | 85e056ee275510c1b7a0c10b500b5b3147cdab57 (diff) | |
| download | mailman-eaf961a7ee46c269c488c3e08ffaafe42fc6a597.tar.gz mailman-eaf961a7ee46c269c488c3e08ffaafe42fc6a597.tar.zst mailman-eaf961a7ee46c269c488c3e08ffaafe42fc6a597.zip | |
main(): Use a more POSIX-ly correct way to extract the exit status and
signal number from the os.wait() status value.
| -rw-r--r-- | bin/mailmanctl | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/bin/mailmanctl b/bin/mailmanctl index 8d9b90750..0f8616dee 100644 --- a/bin/mailmanctl +++ b/bin/mailmanctl @@ -441,22 +441,27 @@ def main(): elif e.errno <> errno.EINTR: raise continue - killsig = status & 0xff - exitstatus = (status >> 8) & 0xff + killsig = exitstatus = None + if os.WIFSIGNALED(status): + killsig = os.WTERMSIG(status) + if os.WIFEXITED(status): + exitstatus = os.WEXITSTATUS(status) # We'll restart the process unless we were given the - # "no-restart" switch, or if the process was SIGTERM'd. This - # lets us better handle runaway restarts (say, if the subproc - # had a syntax error!) - if restart and not (killsig == signal.SIGTERM or - exitstatus == signal.SIGTERM): - restarting = '[restarting]' - else: - restarting = '' + # "no-restart" switch, or if the process was SIGTERM'd or + # exitted with a SIGTERM exit status. This lets us better + # handle runaway restarts (say, if the subproc had a syntax + # error!) + restarting = '' + if restart: + if (exitstatus == None and killsig <> signal.SIGTERM) or \ + (killsig == None and exitstatus <> signal.SIGTERM): + # Then + restarting = '[restarting]' qrname, slice, count = kids[pid] del kids[pid] syslog('qrunner', """\ Master qrunner detected subprocess exit -(pid: %d, sig: %d, sts: %d, class: %s, slice: %d/%d) %s""", +(pid: %d, sig: %s, sts: %s, class: %s, slice: %d/%d) %s""", pid, killsig, exitstatus, qrname, slice+1, count, restarting) # Now perhaps restart the process unless it exited with a |
