do not crash when process is already killed in the mean time
This commit is contained in:
parent
a255b9b715
commit
1c0ff3a121
5
base.py
5
base.py
@ -237,7 +237,10 @@ class ServiceManager:
|
|||||||
for p in procs.get(ins, {}).get(service, []):
|
for p in procs.get(ins, {}).get(service, []):
|
||||||
print_wait = True
|
print_wait = True
|
||||||
for action in ('terminate', 'kill'):
|
for action in ('terminate', 'kill'):
|
||||||
getattr(p, action)() # p.terminate or p.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
|
for i in range(10): # total 0.1 * 10 * 9 / 2 = 4.5 sec
|
||||||
try:
|
try:
|
||||||
p.wait(0.1 * i)
|
p.wait(0.1 * i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user