do not crash when process is already killed in the mean time

This commit is contained in:
l_samenv 2023-08-25 16:58:53 +02:00
parent a255b9b715
commit 1c0ff3a121

View File

@ -237,7 +237,10 @@ class ServiceManager:
for p in procs.get(ins, {}).get(service, []):
print_wait = True
for action in ('terminate', 'kill'):
try:
getattr(p, action)() # p.terminate or p.kill
except psutil.NoSuchProcess:
continue # already killed
for i in range(10): # total 0.1 * 10 * 9 / 2 = 4.5 sec
try:
p.wait(0.1 * i)