From 023de75d6e4b10c058b92f6463e2cfe5fb71bb55 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Thu, 27 Jul 2017 11:09:56 +0200 Subject: fixed interrupts --- lib/app.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/app.py b/lib/app.py index 169fcea..e8f44ad 100644 --- a/lib/app.py +++ b/lib/app.py @@ -36,7 +36,7 @@ class Stout(Commands): else: cmd = cmd.split() count = len(cmd) - + if (count == 1 or count == 2) and cmd[0] not in ListCommands.commands: try: if cmd[0] == 'info' and count == 1: #general info @@ -48,12 +48,14 @@ class Stout(Commands): except (KeyError, IndexError): ListCommands.err('keyword') else: - what = cmd[0] - if what in ListCommands.commands: - self.command(what, cmd) - else: - ListCommands.err('keyword') - + try: + what = cmd[0] + if what in ListCommands.commands: + self.command(what, cmd) + else: + ListCommands.err('keyword') + except IndexError: + pass if __name__ == '__main__': clear() @@ -62,7 +64,7 @@ if __name__ == '__main__': while cmd != 'quit': try: cmd = input('>' + Colors.yellow + app.getName() + Colors.black) - except EOFError: + except (EOFError, KeyboardInterrupt) as e: break app.action(cmd) -- cgit v1.2.3-18-g5258