From 33c9b48106858c9c3fffc818f6e167f94de5b5b1 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Tue, 12 May 2026 10:23:40 +0700 Subject: [PATCH] Clean exit on Ctrl+C without traceback --- scripts/tui.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/tui.py b/scripts/tui.py index ac6cc0c..3ab2295 100644 --- a/scripts/tui.py +++ b/scripts/tui.py @@ -34,7 +34,11 @@ class HendrikTUI: self.h, self.w = 0, 0 def run(self): - curses.wrapper(self._main) + try: + curses.wrapper(self._main) + except KeyboardInterrupt: + pass + print("Exiting.") def _main(self, stdscr): curses.use_default_colors() @@ -56,7 +60,10 @@ class HendrikTUI: self._draw(stdscr) curses.curs_set(0 if self.processing else 2) - key = stdscr.getch() + try: + key = stdscr.getch() + except KeyboardInterrupt: + break if not self.processing: self._handle_key(stdscr, key)