check if process running for kill -9 slsReceiver fail

This commit is contained in:
maliakal_d 2025-05-02 13:55:44 +02:00
parent fb79ba768c
commit 9f4298ac15

View File

@ -35,8 +35,8 @@ def killProcess(name):
try:
cmd = f"kill -9 {pid}"
p = subprocess.run(['kill', '-9', pid])
if p.returncode != 0:
raise RuntimeException("'kill -9' failed for " + name)
if p.returncode != 0 and bool(checkIfProcessRunning(name)):
raise RuntimeException(f"'kill -9' failed for {name} with pid {pid}")
except Exception as e:
Log(Fore.RED, f"Failed to kill process {name} pid:{pid}. Exception occured: [code:{e}, msg:{e.stderr}]")
raise