From 767a94b1d05181bb12d299478d4991a06a4ebb5e Mon Sep 17 00:00:00 2001 From: ALI YESILKAYA Date: Fri, 19 Jun 2026 21:53:15 +0200 Subject: [PATCH] =?UTF-8?q?fix(stt-client):=20stt=20--stop=20d=C3=A9tecte?= =?UTF-8?q?=20le=20process=20lanc=C3=A9=20via=20pipx=20(#26)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `_running_stt_pids` ne regardait que argv[0], or pipx lance `python -E /…/bin/stt --window app` → argv[0] est l'interpréteur, pas `stt` (et le `-E` décale encore le chemin). Du coup `stt --stop` ne trouvait jamais l'instance vocale (« Aucun service ni instance en cours ») alors qu'elle tournait — confirmé en conditions réelles. Désormais on cherche un token qui est un *chemin* vers `stt` (slash + basename `stt`) dans toute la ligne de commande, ce qui écarte aussi le `stt` nu d'un `journalctl -u stt` (faux positif), et on ignore toujours les sous-commandes utilitaires. Co-authored-by: Claude Opus 4.8 --- stt/client/pyproject.toml | 2 +- stt/client/stt/cli.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stt/client/pyproject.toml b/stt/client/pyproject.toml index 20c07d5..4f6d51e 100644 --- a/stt/client/pyproject.toml +++ b/stt/client/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "stt" -version = "0.6.0" +version = "0.6.1" description = "STT — client vocal Jarvis du homelab Funk (voix + HUD, parle au STT-server)" requires-python = ">=3.11" readme = "README.md" diff --git a/stt/client/stt/cli.py b/stt/client/stt/cli.py index b4c6202..c0b130a 100644 --- a/stt/client/stt/cli.py +++ b/stt/client/stt/cli.py @@ -139,7 +139,13 @@ def _running_stt_pids() -> list[int]: continue if not args: continue - if os.path.basename(args[0]) == "stt" and not (utilitaires & set(args)): + # Le chemin du bin `stt` peut être argv[0] (exec direct via shebang) ou un + # token plus loin (lancement pipx : `python -E /…/bin/stt --window app` → + # le `-E` décale le chemin). On cherche un token qui est un *chemin* vers + # `stt` (slash + basename `stt`) — ça écarte le `stt` nu d'un + # `journalctl -u stt` — et on ignore les sous-commandes utilitaires. + is_stt = any("/" in a and os.path.basename(a) == "stt" for a in args) + if is_stt and not (utilitaires & set(args)): pids.append(pid) return pids