diff --git a/op25Handler.py b/op25Handler.py index eff1cfb..29e0dc4 100644 --- a/op25Handler.py +++ b/op25Handler.py @@ -1,5 +1,6 @@ import threading import subprocess +import time import os @@ -37,6 +38,14 @@ class OP25Handler(threading.Thread): print(f"Closing OP25") try: self.OP25Proc.kill() - self.OP25Proc.terminate() + + seconds_waited = 0 + while self.OP25Proc.poll() is None: + # Terminate the process every 5 seconds + if seconds_waited % 5 == 0: + self.OP25Proc.terminate() + time.sleep(1) + seconds_waited += 1 + except Exception as e: print(e)