This commit is contained in:
薇薇安 2026-01-21 14:43:58 +08:00
parent 52e849a586
commit ed5ea8b733
2 changed files with 11 additions and 2 deletions

View File

@ -567,7 +567,12 @@ def _run_supervisorctl(args: list[str]) -> str:
out = (res.stdout or "").strip() out = (res.stdout or "").strip()
err = (res.stderr or "").strip() err = (res.stderr or "").strip()
combined = "\n".join([s for s in [out, err] if s]).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})") raise RuntimeError(combined or f"supervisorctl failed (exit={res.returncode})")
return combined or out return combined or out

View File

@ -200,7 +200,11 @@ def run_supervisorctl(args: list[str], timeout_sec: int = 10) -> str:
out = (res.stdout or "").strip() out = (res.stdout or "").strip()
err = (res.stderr or "").strip() err = (res.stderr or "").strip()
combined = "\n".join([s for s in [out, err] if s]).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})") raise RuntimeError(combined or f"supervisorctl failed (exit={res.returncode})")
return combined or out return combined or out