ClangTidy: Avoid mixing stdout with stderror when dealing with a large number of...
authorAndi-Bogdan Postelnicu <andi@mozilla.com>
Tue, 9 Apr 2019 11:17:02 +0000 (11:17 +0000)
committerAndi-Bogdan Postelnicu <andi@mozilla.com>
Tue, 9 Apr 2019 11:17:02 +0000 (11:17 +0000)
Summary:
At Mozilla we are using this tool in order to perform review-time static-analysis, since some patches contain a large number of files we've discovered this issue, where `stderr` gets mixed with `stdout` thus obfuscating our possibility to parse the output.
The patch that we are currently use can be found [here](https://searchfox.org/mozilla-central/source/build/build-clang/clang-tidy-8.patch).

This is just an upstream of the original patch.

Reviewers: JonasToth

Reviewed By: JonasToth

Subscribers: cfe-commits

Tags: #clang, #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D60453

llvm-svn: 357994

clang-tools-extra/clang-tidy/tool/run-clang-tidy.py

index cfd4f41..648c17e 100755 (executable)
@@ -172,6 +172,7 @@ def run_tidy(args, tmpdir, build_path, queue, lock, failed_files):
     with lock:
       sys.stdout.write(' '.join(invocation) + '\n' + output.decode('utf-8') + '\n')
       if len(err) > 0:
+        sys.stdout.flush()
         sys.stderr.write(err.decode('utf-8') + '\n')
     queue.task_done()