summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-02-01 02:18:36 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-02-01 02:18:36 -0500
commitadc36ff4f7debb526931e5fc04907483033dbf5b (patch)
treeadd012f6e6ef8476ae6d40825ee04a613c97541d /cmd2.py
parent303f82d24824b93967e30e439449c614acc7d4b7 (diff)
downloadcmd2-git-adc36ff4f7debb526931e5fc04907483033dbf5b.tar.gz
Fixed a bug that would occur if a pipe was entered on a line by itself
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd2.py b/cmd2.py
index f7eb7ead..190a5c8f 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -826,7 +826,11 @@ class Cmd(cmd.Cmd):
if s.lower().startswith(shortcut):
s = s.replace(shortcut, expansion + ' ', 1)
break
- result = self.parser.parseString(s)
+ try:
+ result = self.parser.parseString(s)
+ except pyparsing.ParseException:
+ # If we have a parsing failure, treat it is an empty command and move to next prompt
+ result = self.parser.parseString('')
result['raw'] = raw
result['command'] = result.multilineCommand or result.command
result = self.postparse(result)