Patchwork [1,of,3] ui: flush stdout before writing traceback to stderr

login
register
mail settings
Submitter Yuya Nishihara
Date May 31, 2015, 6:19 a.m.
Message ID <ee6f870cc800d5aa585a.1433053181@mimosa>
Download mbox | patch
Permalink /patch/9404/
State Accepted
Headers show

Comments

Yuya Nishihara - May 31, 2015, 6:19 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1433050828 -32400
#      Sun May 31 14:40:28 2015 +0900
# Node ID ee6f870cc800d5aa585a0bafc2110ecb93a18ed3
# Parent  7d24a41200d32b48ff63638c9309877c2e187c91
ui: flush stdout before writing traceback to stderr

Sometimes a traceback message is paired with ui.debug(). This patch makes sure
that these messages are displayed in the right order.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -867,6 +867,7 @@  class ui(object):
                                ''.join(causetb),
                                ''.join(exconly))
             else:
+                self.flush()  # flush debug or status message
                 traceback.print_exception(exc[0], exc[1], exc[2],
                                           file=self.ferr)
         return self.tracebackflag or force