Clean exit on Ctrl+C without traceback
This commit is contained in:
parent
2c2927751a
commit
33c9b48106
@ -34,7 +34,11 @@ class HendrikTUI:
|
||||
self.h, self.w = 0, 0
|
||||
|
||||
def run(self):
|
||||
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)
|
||||
try:
|
||||
key = stdscr.getch()
|
||||
except KeyboardInterrupt:
|
||||
break
|
||||
if not self.processing:
|
||||
self._handle_key(stdscr, key)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user