[PATCH] D115761: [lit] Flush stderr manually on Windows after printing messages

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 18 10:09:44 PST 2021


mstorsjo updated this revision to Diff 395299.
mstorsjo added a comment.

Rerun precommit testing


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115761/new/

https://reviews.llvm.org/D115761

Files:
  libcxx/utils/libcxx/test/config.py
  llvm/utils/lit/lit/LitConfig.py


Index: llvm/utils/lit/lit/LitConfig.py
===================================================================
--- llvm/utils/lit/lit/LitConfig.py
+++ llvm/utils/lit/lit/LitConfig.py
@@ -169,6 +169,11 @@
         line = inspect.getlineno(f)
         sys.stderr.write('%s: %s:%d: %s: %s\n' % (self.progname, file, line,
                                                   kind, message))
+        if self.isWindows:
+            # In a git bash terminal, the writes to sys.stderr aren't visible
+            # on screen immediately. Flush them here to avoid broken/misoredered
+            # output.
+            sys.stderr.flush()
 
     def note(self, message):
         if not self.quiet:
Index: libcxx/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -159,7 +159,6 @@
         self.lit_config.note("Running against the C++ Library at {}".format(self.cxx_runtime_root))
         self.lit_config.note("Linking against the ABI Library at {}".format(self.abi_library_root))
         self.lit_config.note("Running against the ABI Library at {}".format(self.abi_runtime_root))
-        sys.stderr.flush()  # Force flushing to avoid broken output on Windows
 
     def get_test_format(self):
         from libcxx.test.format import LibcxxTestFormat


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115761.395299.patch
Type: text/x-patch
Size: 1368 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211218/ad8596ca/attachment.bin>


More information about the llvm-commits mailing list