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

Function is_daemon_running

ci/util/pio_package_client.py:52–85  ·  view source on GitHub ↗

Check if daemon is running, clean up stale PID files. Returns: True if daemon is running, False otherwise

()

Source from the content-addressed store, hash-verified

50
51
52def is_daemon_running() -> bool:
53 """Check if daemon is running, clean up stale PID files.
54
55 Returns:
56 True if daemon is running, False otherwise
57 """
58 if not PID_FILE.exists():
59 return False
60
61 try:
62 with open(PID_FILE, "r") as f:
63 pid = int(f.read().strip())
64
65 # Check if process exists
66 if psutil.pid_exists(pid):
67 return True
68 else:
69 # Stale PID file - remove it
70 print(f"Removing stale PID file: {PID_FILE}")
71 PID_FILE.unlink()
72 return False
73 except KeyboardInterrupt as ki:
74 handle_keyboard_interrupt(ki)
75 raise
76 except Exception:
77 # Corrupted PID file - remove it
78 try:
79 PID_FILE.unlink(missing_ok=True)
80 except KeyboardInterrupt as ki:
81 handle_keyboard_interrupt(ki)
82 raise
83 except Exception:
84 pass
85 return False
86
87
88def start_daemon() -> None:

Callers 4

mainFunction · 0.90
stop_daemonFunction · 0.85
get_daemon_statusFunction · 0.85

Calls 4

unlinkMethod · 0.80
printFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected