diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-07-20 16:52:05 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-07-20 16:52:05 -0400 |
commit | e58613678539c12afcdc0c8f9731ec5453b1d788 (patch) | |
tree | 7a82f1f35c86e65d8aa50b37121eaa9350bc371d /cmd2 | |
parent | 1fd4e0d6b86fc09fa9112906ad7c18e18a580b4a (diff) | |
download | cmd2-git-e58613678539c12afcdc0c8f9731ec5453b1d788.tar.gz |
Moved common code out of if/else
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/cmd2.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 234223c6..4dfe32a3 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2094,12 +2094,11 @@ class Cmd(cmd.Cmd): temp_file.write(get_paste_buffer()) temp_name = temp_file.name new_stdout = open(temp_name, mode='a+') - saved_state.redirecting = True - sys.stdout = self.stdout = new_stdout else: new_stdout = tempfile.TemporaryFile(mode='w+') - saved_state.redirecting = True - sys.stdout = self.stdout = new_stdout + + saved_state.redirecting = True + sys.stdout = self.stdout = new_stdout return redir_error, saved_state |