summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/cmd2.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index de7e7f5a..d6cb0ee1 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1600,21 +1600,19 @@ class Cmd(cmd.Cmd):
import datetime
stop = False
+ statement = None
+
try:
+ # Convert the line into a Statement
statement = self._input_line_to_statement(line)
- except (EmptyStatement, Cmd2ShlexError) as ex:
- if isinstance(ex, Cmd2ShlexError):
- self.perror("Invalid syntax: {}".format(ex))
- return self._run_cmdfinalization_hooks(stop, None)
- # now that we have a statement, run it with all the hooks
- try:
# call the postparsing hooks
data = plugin.PostparsingData(False, statement)
for func in self._postparsing_hooks:
data = func(data)
if data.stop:
break
+
# unpack the data object
statement = data.statement
stop = data.stop
@@ -1690,6 +1688,8 @@ class Cmd(cmd.Cmd):
except (Cmd2ArgparseError, EmptyStatement):
# Don't do anything, but do allow command finalization hooks to run
pass
+ except Cmd2ShlexError as ex:
+ self.perror("Invalid syntax: {}".format(ex))
except Exception as ex:
self.pexcept(ex)
finally: