forked from qt-creator/qt-creator
ClangTools: Always print stderr output
E.g. clang-tidy prints error messages for invalid config files, but then continues to run and finishes with exit code zero. Fixes: QTCREATORBUG-29298 Change-Id: Idbfb7998994ac8197cd863f4bbb2c64ac1bd5525 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -774,6 +774,9 @@ Group ClangTool::runRecipe(const RunSettings &runSettings,
|
||||
// TODO: postMessage() instead
|
||||
m_runControl->postMessage(message, StdErrFormat);
|
||||
m_runControl->postMessage(output.errorDetails, StdErrFormat);
|
||||
} else if (!output.errorMessage.isEmpty()) {
|
||||
m_runControl->postMessage(output.errorMessage, ErrorMessageFormat);
|
||||
m_runControl->postMessage(output.errorDetails, StdErrFormat);
|
||||
} else {
|
||||
qCDebug(LOG) << "Clang tool task finished with success:"
|
||||
<< output.outputFilePath;
|
||||
|
@@ -165,6 +165,18 @@ GroupItem clangToolTask(const AnalyzeInputData &input,
|
||||
};
|
||||
const auto onProcessDone = [=](const Process &process) {
|
||||
qCDebug(LOG).noquote() << "Output:\n" << process.cleanedStdOut();
|
||||
|
||||
// Here we handle only the case of process success with stderr output.
|
||||
if (!outputHandler)
|
||||
return;
|
||||
if (process.result() != ProcessResult::FinishedWithSuccess)
|
||||
return;
|
||||
const QString stdErr = process.cleanedStdErr();
|
||||
if (stdErr.isEmpty())
|
||||
return;
|
||||
outputHandler(
|
||||
{true, input.unit.file, {}, {}, input.tool, Tr::tr("%1 produced stderr output:")
|
||||
.arg(storage->name), stdErr});
|
||||
};
|
||||
const auto onProcessError = [=](const Process &process) {
|
||||
if (!outputHandler)
|
||||
|
Reference in New Issue
Block a user