Skip to content

Commit 639c1e7

Browse files
committed
Add update functionality
1 parent c6b6f1e commit 639c1e7

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

needlectl/cli/service.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,22 @@ def update(self, force: bool = False, component: Optional[str] = None):
315315
typer.echo("⚠️ Some updates failed. Check the output above for details.")
316316

317317

318-
@service_app.command("start")
319-
def service_start(ctx: typer.Context):
318+
def _is_service_running(self, pid_file: Path) -> bool:
319+
"""Check if a service is running based on PID file."""
320+
if not pid_file.exists():
321+
return False
322+
323+
try:
324+
with open(pid_file, 'r') as f:
325+
pid = int(f.read().strip())
326+
327+
# Check if process is still running
328+
os.kill(pid, 0)
329+
return True
330+
except (OSError, ValueError, FileNotFoundError):
331+
return False
332+
333+
def _get_service_pid(self, pid_file: Path) -> Optional[int]:
320334
"""Get the PID of a service if it's running."""
321335
if not self._is_service_running(pid_file):
322336
return None

0 commit comments

Comments
 (0)