Merge topic 'ctest-subprocess'

cb5f136c66 ctest: Prevent infinite loop in ctest_run_script(NEW_PROCESS)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10286
This commit is contained in:
Brad King 2025-02-05 14:02:51 +00:00 committed by Kitware Robot
commit bc093eefab
2 changed files with 12 additions and 4 deletions

View File

@ -97,7 +97,12 @@ int cmCTestScriptHandler::ExecuteScript(std::string const& total_script_arg)
this->CTest->GetInitialCommandLineArguments();
//*** need to make sure this does not have the current script ***
for (size_t i = 1; i < initArgs.size(); ++i) {
argv.push_back(initArgs[i]);
// in a nested subprocess, skip the parent's `-SR <path>` arguments.
if (initArgs[i] == "-SR") {
i++; // <path>
} else {
argv.push_back(initArgs[i]);
}
}
// Now create process object

View File

@ -1975,9 +1975,12 @@ int cmCTest::Run(std::vector<std::string> const& args)
};
auto const dashSR =
[&runScripts, &SRArgumentSpecified](std::string const& script) -> bool {
SRArgumentSpecified = true;
runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script),
true);
// -SR should be processed only once
if (!SRArgumentSpecified) {
SRArgumentSpecified = true;
runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script),
true);
}
return true;
};
auto const dash_S =