always flush formatter after calling a command

This commit is contained in:
Romain Bignon 2011-08-12 09:54:11 +02:00
commit 18dd9e2b8f
2 changed files with 16 additions and 10 deletions

View file

@ -77,6 +77,9 @@ class TableFormatter(IFormatter):
s += table.get_html_string() s += table.get_html_string()
else: else:
s += table.get_string() s += table.get_string()
self.queue = []
if self.return_only: if self.return_only:
return s return s
else: else:

View file

@ -302,6 +302,7 @@ class ReplApplication(Cmd, ConsoleApplication):
formatter_name = self.DEFAULT_FORMATTER formatter_name = self.DEFAULT_FORMATTER
self.set_formatter(formatter_name) self.set_formatter(formatter_name)
try:
try: try:
return super(ReplApplication, self).onecmd(line) return super(ReplApplication, self).onecmd(line)
except CallErrors, e: except CallErrors, e:
@ -313,6 +314,8 @@ class ReplApplication(Cmd, ConsoleApplication):
except (KeyboardInterrupt, EOFError): except (KeyboardInterrupt, EOFError):
# ^C during a command process doesn't exit application. # ^C during a command process doesn't exit application.
print '\nAborted.' print '\nAborted.'
finally:
self.flush()
def emptyline(self): def emptyline(self):
""" """