diff options
-rwxr-xr-x | cmd2.py | 2 | ||||
-rw-r--r-- | tests/test_cmd2.py | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -1501,7 +1501,7 @@ class Cmd(cmd.Cmd): def preloop(self): """Hook method executed once when the cmdloop() method is called.""" # Register a default SIGINT signal handler for Ctrl+C - signal.signal(signalnum=signal.SIGINT, handler=self.sigint_handler) + signal.signal(signal.SIGINT, self.sigint_handler) def precmd(self, statement): """Hook method executed just before the command is processed by ``onecmd()`` and after adding it to the history. diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index d69bf343..20d477ba 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -915,6 +915,8 @@ def say_app(): return app def test_interrupt_quit(say_app): + say_app.quit_on_sigint = True + # Mock out the input call so we don't actually wait for a user's response on stdin m = mock.MagicMock(name='input') m.side_effect = ['say hello', KeyboardInterrupt(), 'say goodbye', 'eof'] |