diff --git a/selfdrive/pandad/pandad.py b/selfdrive/pandad/pandad.py index 06557e9a991a28..eb35bf25ee218c 100755 --- a/selfdrive/pandad/pandad.py +++ b/selfdrive/pandad/pandad.py @@ -67,20 +67,21 @@ def main() -> NoReturn: # signal pandad to close the relay and exit def signal_handler(signum, frame): cloudlog.info(f"Caught signal {signum}, exiting") - if process is not None and process.poll() is None: - process.terminate() - process.wait() - sys.exit(1) + nonlocal do_exit + do_exit = True + if process is not None: + process.send_signal(signal.SIGINT) process = None - signal.signal(signal.SIGTERM, signal_handler) + signal.signal(signal.SIGINT, signal_handler) count = 0 + do_exit = False first_run = True params = Params() no_internal_panda_count = 0 - while True: + while not do_exit: try: count += 1 cloudlog.event("pandad.flash_and_connect", count=count) diff --git a/system/manager/manager.py b/system/manager/manager.py index 7c4d0e36217d19..89e5a472f23c86 100755 --- a/system/manager/manager.py +++ b/system/manager/manager.py @@ -3,7 +3,6 @@ import os import signal import sys -import time import traceback from cereal import log @@ -172,10 +171,6 @@ def manager_thread() -> None: cloudlog.warning(f"Shutting down manager - {param} set") if shutdown: - # Signal processes to shut down with a small grace period - for p in managed_processes.values(): - p.signal(signal.SIGTERM) - time.sleep(1) break