Fix #12015 by adding pid to filelist name (#5491)

This commit is contained in:
andymacg 2023-10-05 05:44:48 -04:00 committed by GitHub
parent d9a8909d2a
commit f054feba85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -383,7 +383,8 @@ static std::vector<picojson::value> executeAddon(const AddonInfo &addonInfo,
if (!premiumArgs.empty() && !addonInfo.executable.empty())
args += " " + premiumArgs;
const std::string fileArg = (endsWith(file, FILELIST, sizeof(FILELIST)-1) ? " --file-list " : " ") + cmdFileName(file);
const bool is_file_list = (file.find(FILELIST) != std::string::npos);
const std::string fileArg = (is_file_list ? " --file-list " : " ") + cmdFileName(file);
args += fileArg;
std::string result;
@ -1492,7 +1493,7 @@ void CppCheck::executeAddons(const std::vector<std::string>& files)
std::string fileList;
if (files.size() >= 2 || endsWith(files[0], ".ctu-info")) {
fileList = Path::getPathFromFilename(files[0]) + FILELIST;
fileList = Path::getPathFromFilename(files[0]) + FILELIST + std::to_string(getPid());
filesDeleter.addFile(fileList);
std::ofstream fout(fileList);
for (const std::string& f: files)