Flush stderr after write.
authorPatrick Mezard <pmezard@gmail.com>
Wed, 10 Jan 2007 20:35:27 +0100
changeset 4023 6ea8a3b805ee
parent 4022 bf329bda51a6
child 4024 de081fbb27fe
Flush stderr after write. stderr can be buffered under win32 when redirected to a file, including stdout.
mercurial/ui.py
--- a/mercurial/ui.py	Thu Jan 11 23:13:32 2007 +0100
+++ b/mercurial/ui.py	Wed Jan 10 20:35:27 2007 +0100
@@ -385,6 +385,9 @@
             if not sys.stdout.closed: sys.stdout.flush()
             for a in args:
                 sys.stderr.write(str(a))
+            # stderr may be buffered under win32 when redirected to files,
+            # including stdout.
+            if not sys.stderr.closed: sys.stderr.flush()
         except IOError, inst:
             if inst.errno != errno.EPIPE:
                 raise