diff options
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 32d0ae09..8911a188 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3491,13 +3491,16 @@ class Cmd(cmd.Cmd): membuf = io.StringIO() self.stdout = membuf # then run the command and let the output go into our buffer - self.onecmd_plus_hooks(history_item) + stop = self.onecmd_plus_hooks(history_item) # rewind the buffer to the beginning membuf.seek(0) # get the output out of the buffer output = membuf.read() # and add the regex-escaped output to the transcript transcript += output.replace('/', r'\/') + # check if we are supposed to stop + if stop: + break finally: with self.sigint_protection: # Restore altered attributes to their original state |