From ce2516826380939f2241826963493c91dc55016c Mon Sep 17 00:00:00 2001 From: Mike Levin Date: Sat, 1 Aug 2026 23:07:21 -0400 Subject: [PATCH] chore: Handle `play` process exit codes in voice synthesis --- imports/voice_synthesis.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/imports/voice_synthesis.py b/imports/voice_synthesis.py index 6e6bdb83..bd36a154 100644 --- a/imports/voice_synthesis.py +++ b/imports/voice_synthesis.py @@ -263,7 +263,16 @@ def synthesize_and_play(self, text: str) -> bool: stdout=subprocess.DEVNULL ) logger.info(f"🎤 Speaking via nix-shell (PID {self.current_process.pid}): {text[:50]}...") - self.current_process.wait() + rc = self.current_process.wait() + if rc != 0: + # Same false green as the primary path. stderr stays + # DEVNULL here on purpose: this branch fires only when + # `play` is missing entirely, so the exit code alone is + # enough to stop it lying, and the DEVNULL line carries + # trailing whitespace that the patch transport mangles. + logger.error(f"🎤 Audio playback failed via nix-shell (exit {rc}).") + self.last_error = f"nix-shell playback exit {rc}" + return False return True except Exception as nix_e: logger.error(f"🎤 Audio playback failed on {system} (nix fallback): {nix_e}")