Skip to content

Commit

Permalink
Handle Ctrl-C on show list
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-zdanevich committed Jun 15, 2024
1 parent 28667e4 commit 8ea2738
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions geeknote/out.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8ea2738

Please sign in to comment.