mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-06 02:41:48 +00:00
fix: treat ctrl-c as curses cancel
This commit is contained in:
parent
ccb5d87076
commit
df88375f0d
2 changed files with 15 additions and 1 deletions
|
|
@ -508,7 +508,7 @@ class TestPromptPluginEnvVars:
|
|||
|
||||
|
||||
class TestCursesRadiolist:
|
||||
"""Test the curses_radiolist function (non-TTY fallback path)."""
|
||||
"""Test the curses_radiolist function."""
|
||||
|
||||
def test_non_tty_returns_default(self):
|
||||
from hermes_cli.curses_ui import curses_radiolist
|
||||
|
|
@ -524,6 +524,14 @@ class TestCursesRadiolist:
|
|||
result = curses_radiolist("Pick", ["x", "y"], selected=0, cancel_returns=1)
|
||||
assert result == 1
|
||||
|
||||
def test_keyboard_interrupt_returns_cancel_value(self):
|
||||
from hermes_cli.curses_ui import curses_radiolist
|
||||
|
||||
with patch("sys.stdin") as mock_stdin, patch("curses.wrapper", side_effect=KeyboardInterrupt):
|
||||
mock_stdin.isatty.return_value = True
|
||||
result = curses_radiolist("Pick", ["x", "y"], selected=0, cancel_returns=-1)
|
||||
assert result == -1
|
||||
|
||||
|
||||
# ── Provider discovery helpers ───────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue