From 8ea273851dcdac77ec2c4d8b5e9a62fd6c5f78c5 Mon Sep 17 00:00:00 2001 From: Vitaly Zdanevich Date: Sat, 15 Jun 2024 05:09:40 +0400 Subject: [PATCH] Handle Ctrl-C on show list --- geeknote/out.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/geeknote/out.py b/geeknote/out.py index 83f8aef..c6811ba 100644 --- a/geeknote/out.py +++ b/geeknote/out.py @@ -340,20 +340,13 @@ def printList( if showSelector: printLine(" 0 : -Cancel-") - try: - while True: - num = rawInput(": ") - if tools.checkIsInt(num) and 1 <= int(num) <= total: - return listItems[int(num) - 1] - if num == "0" or num == "q": - exit(1) - failureMessage('Incorrect number "%s", ' "please try again:\n" % num) - except (KeyboardInterrupt, SystemExit) as e: - if e.message: - tools.exit(e.message) - else: - tools.exit - + while True: + num = rawInput(": ") + if tools.checkIsInt(num) and 1 <= int(num) <= total: + return listItems[int(num) - 1] + if num == "0" or num == "q": + exit(1) + failureMessage('Incorrect number "%s", ' "please try again:\n" % num) def rawInput(message, isPass=False): if isPass: