  
    stop_download_event = Event()
    assist_fetch_proc = Process(target=downloader_loop, args=(stop_download_event,))
    assist_fetch_proc.start()
    def cleanup(proc):
      cloudlog.warning("caught sig disabling quectel gps")
      gpio_set(GPIO.UBLOX_PWR_EN, False)
      teardown_quectel(diag)
      cloudlog.warning("quectel cleanup done")
      sys.exit(0)
 
</s> remove   signal.signal(signal.SIGINT, lambda sig, frame: cleanup(assist_fetch_proc))
  signal.signal(signal.SIGTERM, lambda sig, frame: cleanup(assist_fetch_proc))
 </s> add   signal.signal(signal.SIGINT, cleanup)
  signal.signal(signal.SIGTERM, cleanup) </s> remove   while not os.path.exists(ASSIST_DATA_FILE) and not event.is_set():
    download_assistance()
    time.sleep(10)
 </s> add   try:
    while not os.path.exists(ASSIST_DATA_FILE) and not event.is_set():
      download_assistance()
      event.wait(timeout=10)
  except KeyboardInterrupt:
    pass
  def cleanup(sig, frame):
  
    stop_download_event = Event()
    assist_fetch_proc = Process(target=downloader_loop, args=(stop_download_event,))
    assist_fetch_proc.start()
  def cleanup(sig, frame):
      cloudlog.warning("caught sig disabling quectel gps")
      gpio_set(GPIO.UBLOX_PWR_EN, False)
      teardown_quectel(diag)
      cloudlog.warning("quectel cleanup done")
      sys.exit(0)
keep keep keep keep replace keep keep keep keep keep
 rawgpsd: better download proc cleanup (#29199)

* rawgpsd: better download proc cleanup

* more

* cleanup

---------

Co-authored-by: Comma Device <device@comma.ai> 
system/sensord/rawgps/rawgpsd.py