summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-04-26 20:50:54 (GMT)
committerBrad King <brad.king@kitware.com>2016-04-27 13:06:47 (GMT)
commit04d74a7f891dc01b2a9c6b1388f303af9404c49b (patch)
treecbdcd6704f4bd7eca81754cf853b793eb9e690df /Source/cmcmd.cxx
parentb8a8dfec3688f1dc44f95528a65135fc76511c7b (diff)
downloadCMake-04d74a7f891dc01b2a9c6b1388f303af9404c49b.zip
CMake-04d74a7f891dc01b2a9c6b1388f303af9404c49b.tar.gz
CMake-04d74a7f891dc01b2a9c6b1388f303af9404c49b.tar.bz2
Clang-Tidy: copy stdout to sterr; ignore original stderr
Clang-Tidy writes the number of warnings, the number of suppressed warnings, and instructions on how to suppress warnings to stderr. Since each source file is checked individually, this repetitive information is disturbing and should be suppressed. The actual warning messages are written to stdout. Some IDEs (eg. QtCreator) analyze only stderr for issues. Redirecting Clang-Tidy's stdout to stderr makes sure the warnings are correctly displayed.
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 3c28c35..0b9518c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -389,13 +389,17 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
tidy_cmd.push_back("--");
tidy_cmd.insert(tidy_cmd.end(), orig_cmd.begin()+1, orig_cmd.end());
- // Run the tidy command line.
- if(!cmSystemTools::RunSingleCommand(tidy_cmd, 0, 0, &ret, 0,
- cmSystemTools::OUTPUT_PASSTHROUGH))
+ // Run the tidy command line. Capture its stdout and hide its stderr.
+ std::string stdOut;
+ if(!cmSystemTools::RunSingleCommand(tidy_cmd, &stdOut, 0, &ret, 0,
+ cmSystemTools::OUTPUT_NONE))
{
std::cerr << "Error running '" << tidy_cmd[0] << "'\n";
return 1;
}
+
+ // Output the stdout from clang-tidy to stderr
+ std::cerr << stdOut;
}
// Now run the real compiler command and return its result value.