aboutsummaryrefslogtreecommitdiff
path: root/app/backends/faster.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/backends/faster.py')
-rwxr-xr-xapp/backends/faster.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/app/backends/faster.py b/app/backends/faster.py
index 585e480..8c64183 100755
--- a/app/backends/faster.py
+++ b/app/backends/faster.py
@@ -591,21 +591,32 @@ def _detect_remote(managed: bool = False):
return False, {}
-def uninstall() -> int:
+def uninstall(*, emit=None, cancel=None) -> int:
"""Remove the faster-qwen3-tts backend entirely.
Uninstalls the pip package (``faster-qwen3-tts``) from the managed venv
and deletes the cloned checkout (``app/faster-qwen3-tts``, which holds
examples/openai_server.py and voices.json). A running server this tool
- started is stopped first (best-effort). Returns the exit code.
+ started is stopped first (best-effort).
+
+ With EMIT given (the in-TUI task view) pip runs piped, streaming into
+ EMIT, so its output never touches the terminal behind curses. CANCEL is
+ a ``threading.Event`` honored between phases only (stop server / pip /
+ delete checkout) — a started phase always completes, so pip is never
+ killed mid-run. Returns the exit code (130 when cancelled before a
+ remaining phase).
"""
servers.stop("faster")
- rc = common.pip_uninstall(["faster-qwen3-tts"])
+ if common.cancel_requested(cancel):
+ return 130
+ rc = common.pip_uninstall(["faster-qwen3-tts"], emit=emit)
if rc != 0:
print("[WARNING] pip uninstall failed (exit "
f"{rc}); remove faster-qwen3-tts from the managed venv manually")
else:
print("[OK] faster-qwen3-tts removed.")
+ if common.cancel_requested(cancel):
+ return 130
checkout = _checkout()
if checkout.is_dir():
print(f"[INFO] Removing checkout {checkout}...")