From 4b49797b4d57c2d2cf63472636622a7a6280a38e Mon Sep 17 00:00:00 2001 From: historia Date: Tue, 25 Aug 2026 18:10:08 -0400 Subject: feat: no console drop when uninstalling backends --- app/backends/audiocpp.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'app/backends/audiocpp.py') diff --git a/app/backends/audiocpp.py b/app/backends/audiocpp.py index 0feb480..31aa01d 100755 --- a/app/backends/audiocpp.py +++ b/app/backends/audiocpp.py @@ -1650,16 +1650,25 @@ def delete_model_files(server_json: Path, entries: List[dict]) -> int: return removed -def uninstall() -> int: +def uninstall(*, emit=None, cancel=None) -> int: """Remove the audio.cpp backend entirely: stop its server, delete the checkout. The checkout (``app/audio.cpp``, or wherever ``find_local_checkout`` resolves it) holds the built binary, the downloaded models, and the server.json, so removing the directory uninstalls the backend. A running - server this tool started is stopped first (best-effort). Returns the exit - code. + server this tool started is stopped first (best-effort). + + EMIT is accepted for registry symmetry with the other backends but is + unused here — this uninstall has no subprocess phase, and its prints are + captured by the task view when run in the TUI. CANCEL is a + ``threading.Event`` honored between phases only (after the server has + been stopped, before the checkout is deleted), so a started phase always + completes and the uninstall never tears halfway. Returns the exit code + (130 when cancelled before a remaining phase). """ servers.stop("audiocpp") + if common.cancel_requested(cancel): + return 130 checkout = find_local_checkout() if checkout is None: print("[INFO] No audio.cpp checkout to remove.") -- cgit v1.2.3