fix Clang execution

This commit is contained in:
Daniel Marjamäki 2020-05-19 19:17:23 +02:00
parent f5f7cb7ff7
commit 64291c6b61
2 changed files with 8 additions and 4 deletions

View File

@ -44,8 +44,11 @@ static bool executeCommand(std::string exe, std::vector<std::string> 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<std::string> args, std::
std::ofstream fout(redirect.substr(3));
fout << process.readAllStandardError().toStdString();
}
return true;
return process.exitCode() == 0;
}

View File

@ -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;
}