From 79bf87d1e333ea5fe0dfeb61c707eb9bddfd0255 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Fri, 30 Apr 2021 12:41:02 -0400 Subject: Removed cmd2.Cmd.quit_on_sigint. --- cmd2/cmd2.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'cmd2') diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index cc1d5e6b..418f8a4f 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -293,7 +293,6 @@ class Cmd(cmd.Cmd): # Attributes which should NOT be dynamically settable via the set command at runtime self.default_to_shell = False # Attempt to run unrecognized commands as shell commands - self.quit_on_sigint = False # Ctrl-C at the prompt will quit the program instead of just resetting prompt self.allow_redirection = allow_redirection # Security setting to prevent redirection of stdout # Attributes which ARE dynamically settable via the set command at runtime @@ -2490,13 +2489,10 @@ class Cmd(cmd.Cmd): nextline = '\n' self.poutput(nextline) line = f'{self._multiline_in_progress}{nextline}' - except KeyboardInterrupt as ex: - if self.quit_on_sigint: - raise ex - else: - self.poutput('^C') - statement = self.statement_parser.parse('') - break + except KeyboardInterrupt: + self.poutput('^C') + statement = self.statement_parser.parse('') + break finally: self._at_continuation_prompt = False @@ -3067,12 +3063,9 @@ class Cmd(cmd.Cmd): # Get commands from user try: line = self._read_command_line(self.prompt) - except KeyboardInterrupt as ex: - if self.quit_on_sigint: - raise ex - else: - self.poutput('^C') - line = '' + except KeyboardInterrupt: + self.poutput('^C') + line = '' # Run the command along with all associated pre and post hooks stop = self.onecmd_plus_hooks(line) -- cgit v1.2.1