Mercurial > hg
diff tests/killdaemons.py @ 49309:d54b213c4380
py3: catch ProcessLookupError instead of checking errno == ESRCH
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Tue, 31 May 2022 23:45:33 +0200 |
parents | 6000f5b25c9b |
children | 493034cc3265 |
line wrap: on
line diff
--- a/tests/killdaemons.py Tue May 31 23:41:15 2022 +0200 +++ b/tests/killdaemons.py Tue May 31 23:45:33 2022 +0200 @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import errno import os import signal import sys @@ -93,9 +92,8 @@ os.kill(pid, 0) logfn('# Daemon process %d is stuck - really killing it' % pid) os.kill(pid, signal.SIGKILL) - except OSError as err: - if err.errno != errno.ESRCH: - raise + except ProcessLookupError: + pass def killdaemons(pidfile, tryhard=True, remove=False, logfn=None):