Skip to content

Commit

Permalink
Merge pull request #126 from olcf/ngin_improve_interpreter
Browse files Browse the repository at this point in the history
keyboard interrupt issues
  • Loading branch information
Noah Ginsburg authored Oct 2, 2019
2 parents 6fd8e9e + 6ab7b03 commit 772d5cd
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion libpkpass/commands/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Interpreter(Command):
def _run_command_execution(self):
""" Run function for class. """
####################################################################
Interactive(self.args, self.identities).cmdloop()
Interactive(self.args, self.identities).cmdloop_with_keyboard_interrupt()

####################################################################
def _validate_args(self):
Expand Down Expand Up @@ -105,6 +105,24 @@ def __init__(self, args, recipients_database):
# We basically need to grab the first argument and ditch it
self.parsedargs = {}


####################################################################
def cmdloop_with_keyboard_interrupt(self):
"""handle keyboard interrupts"""
####################################################################
breaker = False
first = True
while breaker is not True:
try:
if first:
self.cmdloop()
else:
self.cmdloop(intro='')
breaker = True
except KeyboardInterrupt:
first = False
sys.stdout.write('\n')

####################################################################
def _change_pwstore(self):
"""Change directory"""
Expand Down

0 comments on commit 772d5cd

Please sign in to comment.