--- a/mercurial/worker.py Tue May 31 23:41:15 2022 +0200
+++ b/mercurial/worker.py Tue May 31 23:45:33 2022 +0200
@@ -6,7 +6,6 @@
# GNU General Public License version 2 or any later version.
-import errno
import os
import pickle
import selectors
@@ -177,9 +176,8 @@
for p in pids:
try:
os.kill(p, signal.SIGTERM)
- except OSError as err:
- if err.errno != errno.ESRCH:
- raise
+ except ProcessLookupError:
+ pass
def waitforworkers(blocking=True):
for pid in pids.copy():
--- 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):