From 0512a932bbf3b87619b6a250f87eb7904d22d1f7 Mon Sep 17 00:00:00 2001 From: historia Date: Mon, 24 Aug 2026 04:53:43 -0400 Subject: feat: hide convert/config/start-stop menus if no valid installation --- app/backends/servers.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/backends/servers.py') diff --git a/app/backends/servers.py b/app/backends/servers.py index a5a6829..63f37ce 100644 --- a/app/backends/servers.py +++ b/app/backends/servers.py @@ -233,6 +233,22 @@ def stop(name: str) -> bool: return killed +def manages(specs) -> bool: + """True when any SPEC in the list was started (and is kept alive) by us. + + A server counts as ours when ``start`` recorded a pid file for it and + that pid is still alive — the same ownership rule ``stop`` applies + before refusing ("not started by this tool"). Used by the backends' + ``detect()`` so the hub's status table can tag an up server as + "[remote]" when it was launched outside this tool. + """ + for spec in specs: + pid = pid_for(spec.name) + if pid is not None and _pid_alive(pid): + return True + return False + + def pid_for(name: str): """Return the recorded pid for NAME, or None when no pid file exists.""" pid_file = _pid_path(name) -- cgit v1.2.3