mirror of
https://github.com/wu736139669/OpsPilot.git
synced 2026-08-05 06:23:35 +00:00
fix: get_tmux_status now checks exit code for dead sessions
tmux list-windows returns exit code 1 + stderr "can't find session" when the session doesn't exist. Previously this was ignored, causing killed sessions to still show as online with empty windows. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -100,6 +100,9 @@ def get_tmux_status(session_name: str) -> dict:
|
|||||||
["tmux", "list-windows", "-t", session_name, "-F", "#{window_index}:#{window_name}:#{window_active}"],
|
["tmux", "list-windows", "-t", session_name, "-F", "#{window_index}:#{window_name}:#{window_active}"],
|
||||||
capture_output=True, text=True, timeout=5
|
capture_output=True, text=True, timeout=5
|
||||||
)
|
)
|
||||||
|
# Exit code non-zero means session doesn't exist
|
||||||
|
if result.returncode != 0 or "can't find session" in result.stderr.lower() or "no server running" in result.stderr.lower():
|
||||||
|
return {"running": False, "windows": [], "active_window": None}
|
||||||
windows = []
|
windows = []
|
||||||
active_window = None
|
active_window = None
|
||||||
for line in result.stdout.strip().split("\n"):
|
for line in result.stdout.strip().split("\n"):
|
||||||
|
|||||||
Reference in New Issue
Block a user