MCPcopy Create free account
hub / github.com/FastLED/FastLED / signal_handler

Function signal_handler

ci/util/pio_package_daemon.py:737–759  ·  view source on GitHub ↗

Handle SIGTERM/SIGINT - refuse shutdown during installation.

(signum: int, frame: object)

Source from the content-addressed store, hash-verified

735
736
737def signal_handler(signum: int, frame: object) -> None:
738 """Handle SIGTERM/SIGINT - refuse shutdown during installation."""
739 global _installation_in_progress
740
741 signal_name = "SIGTERM" if signum == signal.SIGTERM else "SIGINT"
742
743 with _installation_lock:
744 if _installation_in_progress:
745 logging.warning(
746 f"Received {signal_name} during active package installation. "
747 f"Refusing graceful shutdown. Use force kill (SIGKILL) to terminate."
748 )
749 print(
750 f"\n⚠️ {signal_name} received during package installation\n"
751 f"⚠️ Cannot shutdown gracefully while installation is active\n"
752 f"⚠️ Installation must complete atomically to prevent corruption\n"
753 f"⚠️ Use 'kill -9 {os.getpid()}' to force termination (may corrupt packages)\n",
754 flush=True,
755 )
756 return # Refuse shutdown
757 else:
758 logging.info(f"Received {signal_name}, shutting down gracefully")
759 cleanup_and_exit()
760
761
762def cleanup_and_exit() -> None:

Callers

nothing calls this directly

Calls 4

cleanup_and_exitFunction · 0.85
warningMethod · 0.80
printFunction · 0.50
infoMethod · 0.45

Tested by

no test coverage detected