MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / signal_handler

Function signal_handler

launch_camoufox.py:348–364  ·  view source on GitHub ↗
(sig, frame)

Source from the content-addressed store, hash-verified

346
347
348def signal_handler(sig, frame):
349 from config.global_state import GlobalState
350
351 logger.info(
352 f"Received signal {signal.Signals(sig).name} ({sig}). Setting IS_SHUTTING_DOWN event..."
353 )
354 GlobalState.IS_SHUTTING_DOWN.set()
355 logger.info("Initiating exit procedure (Force Exit)...")
356
357 # [FIX-ZOMBIE] Run cleanup explicitly because os._exit skips atexit
358 try:
359 cleanup()
360 except Exception as e:
361 logger.error(f"Error during cleanup in signal handler: {e}")
362
363 logger.info("Exiting with os._exit(0)")
364 os._exit(0)
365
366
367signal.signal(signal.SIGINT, signal_handler)

Callers

nothing calls this directly

Calls 6

wait_for_cancellationFunction · 0.85
infoMethod · 0.80
setMethod · 0.80
errorMethod · 0.80
warningMethod · 0.80
cleanupFunction · 0.70

Tested by

no test coverage detected