sanitycheck: Add exception check

Add exception check for psutil when running CI with nSIM

Sometimes nSIM random failures may turn nsimdrv process into zombie
process, parent process can't terminate it by calling proc.wait(0.1)
and kill command doesn't apply to zombie process

Signed-off-by: Jingru Wang <jingru@synopsys.com>
This commit is contained in:
Jingru Wang 2020-12-17 10:16:59 +08:00 committed by Anas Nashif
commit f20c15caaf

View file

@ -454,7 +454,10 @@ class BinaryHandler(Handler):
# work. Newer ninja's don't seem to pass SIGTERM down to the children
# so we need to use try_kill_process_by_pid.
for child in psutil.Process(proc.pid).children(recursive=True):
os.kill(child.pid, signal.SIGTERM)
try:
os.kill(child.pid, signal.SIGTERM)
except ProcessLookupError:
pass
proc.terminate()
# sleep for a while before attempting to kill
time.sleep(0.5)