##// END OF EJS Templates
py3: catch ProcessLookupError instead of checking errno == ESRCH
Manuel Jacob -
r50204:d54b213c default
parent child Browse files
Show More
@@ -6,7 +6,6 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8
8
9 import errno
10 import os
9 import os
11 import pickle
10 import pickle
12 import selectors
11 import selectors
@@ -177,9 +176,8 b' def _posixworker(ui, func, staticargs, a'
177 for p in pids:
176 for p in pids:
178 try:
177 try:
179 os.kill(p, signal.SIGTERM)
178 os.kill(p, signal.SIGTERM)
180 except OSError as err:
179 except ProcessLookupError:
181 if err.errno != errno.ESRCH:
180 pass
182 raise
183
181
184 def waitforworkers(blocking=True):
182 def waitforworkers(blocking=True):
185 for pid in pids.copy():
183 for pid in pids.copy():
@@ -1,6 +1,5 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python3
2
2
3 import errno
4 import os
3 import os
5 import signal
4 import signal
6 import sys
5 import sys
@@ -93,9 +92,8 b' else:'
93 os.kill(pid, 0)
92 os.kill(pid, 0)
94 logfn('# Daemon process %d is stuck - really killing it' % pid)
93 logfn('# Daemon process %d is stuck - really killing it' % pid)
95 os.kill(pid, signal.SIGKILL)
94 os.kill(pid, signal.SIGKILL)
96 except OSError as err:
95 except ProcessLookupError:
97 if err.errno != errno.ESRCH:
96 pass
98 raise
99
97
100
98
101 def killdaemons(pidfile, tryhard=True, remove=False, logfn=None):
99 def killdaemons(pidfile, tryhard=True, remove=False, logfn=None):
General Comments 0
You need to be logged in to leave comments. Login now