summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)