diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-08-23 15:10:29 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-08-23 15:10:29 -0400 |
commit | 261f5256ba93a15eda7f0631ce3df93d72164a62 (patch) | |
tree | a6452740bc96316172ba71af1ad52bf46473bdc6 /cmd2/py_bridge.py | |
parent | 1a85bfe045490916c0827b8bb6119b47d66f4d8d (diff) | |
download | cmd2-git-last_result.tar.gz |
All cmd2 built-in commands now populate self.last_resultlast_result
Diffstat (limited to 'cmd2/py_bridge.py')
-rw-r--r-- | cmd2/py_bridge.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd2/py_bridge.py b/cmd2/py_bridge.py index 6fd00e07..ab7b4001 100644 --- a/cmd2/py_bridge.py +++ b/cmd2/py_bridge.py @@ -73,8 +73,8 @@ class CommandResult(NamedTuple): def __bool__(self) -> bool: """Returns True if the command succeeded, otherwise False""" - # If data has a __bool__ method, then call it to determine success of command - if self.data is not None and callable(getattr(self.data, '__bool__', None)): + # If data was set, then use it to determine success + if self.data is not None: return bool(self.data) # Otherwise check if stderr was filled out |