Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix(resume-picker): cancel on ctrl+c during drawing too
Ahmed Allamaa3144dac47e
diff --git a/strix/interface/resume_picker.py b/strix/interface/resume_picker.pyindex 13c98de9..bd9e6268 100644--- a/strix/interface/resume_picker.py+++ b/strix/interface/resume_picker.py@@ -380,14 +380,12 @@ class ResumePicker:try:self.draw()while True:- try:- key = next_key()- except KeyboardInterrupt:- key = KEY_INTERRUPT- done, chosen = self.handle(key)+ done, chosen = self.handle(next_key())if done:return chosenself.draw()+ except KeyboardInterrupt:+ return Nonefinally:self.clear()self.console.file.write(_CURSOR_SHOW)diff --git a/tests/test_resume_picker.py b/tests/test_resume_picker.pyindex f86bd44d..1999150f 100644--- a/tests/test_resume_picker.py+++ b/tests/test_resume_picker.py@@ -230,6 +230,20 @@ def test_sigint_while_waiting_for_a_key_cancels_and_restores_the_cursor() -> Nonassert buffer.getvalue().endswith("\x1b[?25h")+def test_sigint_while_drawing_cancels_and_restores_the_cursor() -> None:+ console, buffer = _console()+ picker = ResumePicker(RUNS, console=console, runs_dir="strix_runs", now=NOW)+ draw = picker.draw++ def interrupted_draw() -> None:+ draw()+ raise KeyboardInterrupt++ picker.draw = interrupted_draw # type: ignore[method-assign]+ assert picker.run(lambda: KEY_DOWN) is None+ assert buffer.getvalue().endswith("\x1b[?25h")++def test_pick_run_needs_a_terminal() -> None:console, _ = _console()with pytest.raises(PickerUnavailableError):