From ed5ea8b733b2d64171ea927b920dd63b1c376a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=87=E8=96=87=E5=AE=89?= Date: Wed, 21 Jan 2026 14:43:58 +0800 Subject: [PATCH] a --- backend/api/routes/system.py | 7 ++++++- backend/api/supervisor_account.py | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/api/routes/system.py b/backend/api/routes/system.py index 30b2ef0..d487e65 100644 --- a/backend/api/routes/system.py +++ b/backend/api/routes/system.py @@ -567,7 +567,12 @@ def _run_supervisorctl(args: list[str]) -> str: out = (res.stdout or "").strip() err = (res.stderr or "").strip() combined = "\n".join([s for s in [out, err] if s]).strip() - if res.returncode != 0: + # supervisorctl 约定: + # - status 在存在 STOPPED/FATAL 等进程时可能返回 exit=3,但输出仍然有效 + ok_rc = {0} + if args and args[0] == "status": + ok_rc.add(3) + if res.returncode not in ok_rc: raise RuntimeError(combined or f"supervisorctl failed (exit={res.returncode})") return combined or out diff --git a/backend/api/supervisor_account.py b/backend/api/supervisor_account.py index 6a53d6f..475d800 100644 --- a/backend/api/supervisor_account.py +++ b/backend/api/supervisor_account.py @@ -200,7 +200,11 @@ def run_supervisorctl(args: list[str], timeout_sec: int = 10) -> str: out = (res.stdout or "").strip() err = (res.stderr or "").strip() combined = "\n".join([s for s in [out, err] if s]).strip() - if res.returncode != 0: + # supervisorctl: status 在存在 STOPPED 等进程时可能返回 exit=3,但输出仍然有效 + ok_rc = {0} + if args and args[0] == "status": + ok_rc.add(3) + if res.returncode not in ok_rc: raise RuntimeError(combined or f"supervisorctl failed (exit={res.returncode})") return combined or out