fix: move process_loop voice restart to daemon thread, use _cprint consistently

- process_loop's continuous mode restart called _voice_start_recording()
  directly, blocking the loop if play_beep/sd.wait hangs — queued user
  input would stall silently. Dispatch to daemon thread like Ctrl+B handler.
- Replace print() with _cprint() in _handle_voice_command for consistency
  with the rest of the voice mode code.
This commit is contained in:
0xbyt4 2026-03-10 13:31:50 +03:00
parent d0e3b39e69
commit 9d58cafec9
2 changed files with 19 additions and 16 deletions

View file

@ -875,16 +875,15 @@ class TestHandleVoiceCommandReal:
cli._handle_voice_command("/voice")
cli._enable_voice_mode.assert_called_once()
@patch("builtins.print")
@patch("cli._cprint")
def test_unknown_subcommand(self, _cp, mock_print):
def test_unknown_subcommand(self, mock_cp):
cli = self._cli()
cli._handle_voice_command("/voice foobar")
cli._enable_voice_mode.assert_not_called()
cli._disable_voice_mode.assert_not_called()
# Should print usage via print() (not _cprint)
# Should print usage via _cprint
assert any("Unknown" in str(c) or "unknown" in str(c)
for c in mock_print.call_args_list)
for c in mock_cp.call_args_list)
class TestEnableVoiceModeReal: