diff options
Diffstat (limited to 'cmd2/pyscript_bridge.py')
-rw-r--r-- | cmd2/pyscript_bridge.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd2/pyscript_bridge.py b/cmd2/pyscript_bridge.py index 47ce29db..1c720cf9 100644 --- a/cmd2/pyscript_bridge.py +++ b/cmd2/pyscript_bridge.py @@ -87,20 +87,19 @@ class PyscriptBridge(object): # This will be used to capture _cmd2_app.stdout and sys.stdout copy_cmd_stdout = StdSim(self._cmd2_app.stdout, echo) + # Pause the storing of stdout until onecmd_plus_hooks enables it + copy_cmd_stdout.pause_storage = True + # This will be used to capture sys.stderr copy_stderr = StdSim(sys.stderr, echo) - # Pause the storing of any output until onecmd_plus_hooks enables it - copy_cmd_stdout.pause_storage = True - copy_stderr.pause_storage = True - self._cmd2_app._last_result = None try: self._cmd2_app.stdout = copy_cmd_stdout with redirect_stdout(copy_cmd_stdout): with redirect_stderr(copy_stderr): - self._cmd2_app.onecmd_plus_hooks(command) + self._cmd2_app.onecmd_plus_hooks(command, pyscript_bridge_call=True) finally: self._cmd2_app.stdout = copy_cmd_stdout.inner_stream |