aboutsummaryrefslogtreecommitdiff
path: root/app/backends/qwen.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-26 00:21:28 -0400
committerhistoria <historiavg@proton.me>2026-08-26 00:21:28 -0400
commit7cf7d2f7849936e3c84ee431433c2e8bcb6706ac (patch)
tree80d753cbd35929187ffc717a45f7bc3e9cbdbb1e /app/backends/qwen.py
parent4c3e78c39c81d2997e88b84e1b5a25b244e870e4 (diff)
downloadtts-audiobook-generator-7cf7d2f7849936e3c84ee431433c2e8bcb6706ac.tar.gz
fix: harden server start/stop guards
Diffstat (limited to 'app/backends/qwen.py')
-rw-r--r--app/backends/qwen.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/backends/qwen.py b/app/backends/qwen.py
index cc84f8e..33e7114 100644
--- a/app/backends/qwen.py
+++ b/app/backends/qwen.py
@@ -354,8 +354,12 @@ def uninstall(*, emit=None, cancel=None) -> int:
so pip is never killed mid-run. Returns the exit code (130 when
cancelled before pip ran).
"""
- servers.stop("qwen-custom")
- servers.stop("qwen-clone")
+ for name in ("qwen-custom", "qwen-clone"):
+ # Only stop when a pid file exists: without one this tool never
+ # started the server, so the "not started by this tool" notice
+ # would be uninstall-time noise.
+ if servers.pid_for(name) is not None:
+ servers.stop(name)
if common.cancel_requested(cancel):
return 130
rc = common.pip_uninstall([QWEN_PIP_PKG], emit=emit)
@@ -364,7 +368,7 @@ def uninstall(*, emit=None, cancel=None) -> int:
f"{QWEN_PIP_PKG} from the managed venv manually")
else:
print(f"[OK] {QWEN_PIP_PKG} removed.")
- return 0
+ return rc
def main() -> int: