summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-24 21:20:58 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-09-24 21:20:58 -0400
commit3a7dff372be39ef668a93f2cee9c40291f096521 (patch)
tree911473c26ca90e0b88084ca5889b180b438005e4 /cmd2/cmd2.py
parentfafdc4b11a56e98bcc36715082552b6465d3a225 (diff)
downloadcmd2-git-3a7dff372be39ef668a93f2cee9c40291f096521.tar.gz
Made small tweak to do_py to improve testability
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index c2d3eb1c..972a2be4 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2695,9 +2695,11 @@ Usage: Usage: unalias [-a] name [name ...]
Non-python commands can be issued with ``pyscript_name("your command")``.
Run python code from external script files with ``run("script.py")``
"""
- from .pyscript_bridge import PyscriptBridge
+ from .pyscript_bridge import PyscriptBridge, CommandResult
if self._in_py:
- self.perror("Recursively entering interactive Python consoles is not allowed.", traceback_war=False)
+ err = "Recursively entering interactive Python consoles is not allowed."
+ self.perror(err, traceback_war=False)
+ self._last_result = CommandResult('', err)
return False
self._in_py = True