diff --git a/main.py b/main.py old mode 100755 new mode 100644 diff --git a/nullptr/command_line.py b/nullptr/command_line.py index 100fe2c..e61e9b7 100644 --- a/nullptr/command_line.py +++ b/nullptr/command_line.py @@ -87,11 +87,13 @@ class CommandLine: p = self.prompt() try: c = input(p) - except EOFError: + except (EOFError, KeyboardInterrupt): self.handle_eof() break try: self.handle_cmd(c) - except Exception as e: + except KeyboardInterrupt: + print("Interrupted") + except (Exception) as e: logging.error(e, exc_info=True) diff --git a/nullptr/commander.py b/nullptr/commander.py index a2c3069..34a8694 100644 --- a/nullptr/commander.py +++ b/nullptr/commander.py @@ -24,6 +24,10 @@ class Commander(CommandLine): self.stop_auto= False super().__init__() + def handle_eof(self): + self.store.close() + print("Goodbye!") + def prompt(self): if self.ship: return f'{self.ship.symbol}> '