CLI: fix execute command, quote argument that contains spaces

This commit is contained in:
Daniel Marjamäki 2020-08-30 20:02:18 +02:00
parent d23fd26ce0
commit dc6f0740c1
1 changed files with 4 additions and 1 deletions

View File

@ -1176,7 +1176,10 @@ bool CppCheckExecutor::executeCommand(std::string exe, std::vector<std::string>
for (const std::string &arg : args) { for (const std::string &arg : args) {
if (!joinedArgs.empty()) if (!joinedArgs.empty())
joinedArgs += " "; joinedArgs += " ";
joinedArgs += arg; if (arg.find(" ") != std::string::npos)
joinedArgs += '"' + arg + '"';
else
joinedArgs += arg;
} }
#ifdef _WIN32 #ifdef _WIN32