From 64291c6b61997942ba42ea563477f8475956f023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 19 May 2020 19:17:23 +0200 Subject: [PATCH] fix Clang execution --- gui/checkthread.cpp | 9 ++++++--- lib/cppcheck.cpp | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gui/checkthread.cpp b/gui/checkthread.cpp index db271b5b3..7b5ef6492 100644 --- a/gui/checkthread.cpp +++ b/gui/checkthread.cpp @@ -44,8 +44,11 @@ static bool executeCommand(std::string exe, std::vector args, std:: process.start(QString::fromStdString(exe), args2); process.waitForFinished(); - if (redirect == "2>&1") - *output = process.readAll().toStdString(); + if (redirect == "2>&1") { + QString s1 = process.readAllStandardOutput(); + QString s2 = process.readAllStandardError(); + *output = (s1 + "\n" + s2).toStdString(); + } else *output = process.readAllStandardOutput().toStdString(); @@ -53,7 +56,7 @@ static bool executeCommand(std::string exe, std::vector args, std:: std::ofstream fout(redirect.substr(3)); fout << process.readAllStandardError().toStdString(); } - return true; + return process.exitCode() == 0; } diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index f4784f319..03b95f86e 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -327,7 +327,8 @@ unsigned int CppCheck::check(const std::string &path) #endif const std::string args1 = "-v -fsyntax-only " + lang + " " + tempFile; std::string output1; - if (!mExecuteCommand(exe, split(args1), "2>&1", &output1) || output1.find(" -cc1 ") == std::string::npos) { + mExecuteCommand(exe, split(args1), "2>&1", &output1); + if (output1.find(" -cc1 ") == std::string::npos) { mErrorLogger.reportOut("Failed to execute '" + exe + "':" + output1); return 0; }