diff options
author | Brad King <brad.king@kitware.com> | 2024-10-03 12:05:02 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-10-03 12:05:11 (GMT) |
commit | 31db1a047e5911f4eda14a044910fe1e4e2baa61 (patch) | |
tree | 035bf34c2e1ee750dd2c9a745055dffbae96fbda /Source | |
parent | 6849604dd2fc4c07f65a78335a3e40ba6c3064dd (diff) | |
parent | f3dcbfaa8c6d52fe883472b2c243d53a1600f6c5 (diff) | |
download | CMake-31db1a047e5911f4eda14a044910fe1e4e2baa61.zip CMake-31db1a047e5911f4eda14a044910fe1e4e2baa61.tar.gz CMake-31db1a047e5911f4eda14a044910fe1e4e2baa61.tar.bz2 |
Merge topic 'ctest-sp-recursion'
f3dcbfaa8c CTest: Avoid infinite recursion with -SP option
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9870
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 2003ce6..ed567d4 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -139,10 +139,10 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) { // execute the script passing in the arguments to the script as well as the // arguments from this invocation of cmake - std::vector<const char*> argv; - argv.push_back(cmSystemTools::GetCTestCommand().c_str()); + std::vector<std::string> argv; + argv.push_back(cmSystemTools::GetCTestCommand()); argv.push_back("-SR"); - argv.push_back(total_script_arg.c_str()); + argv.push_back(total_script_arg); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Executable for CTest is: " << cmSystemTools::GetCTestCommand() @@ -151,10 +151,14 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) // now pass through all the other arguments std::vector<std::string>& initArgs = 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]); + } // Now create process object cmUVProcessChainBuilder builder; - builder.AddCommand(initArgs) + builder.AddCommand(argv) .SetBuiltinStream(cmUVProcessChainBuilder::Stream_OUTPUT) .SetBuiltinStream(cmUVProcessChainBuilder::Stream_ERROR); auto process = builder.Start(); @@ -210,13 +214,10 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg) std::ostringstream message; message << "Error running command: ["; message << static_cast<int>(result.first) << "] "; - for (const char* arg : argv) { - if (arg) { - message << arg << " "; - } + for (std::string const& arg : argv) { + message << arg << " "; } - cmCTestLog(this->CTest, ERROR_MESSAGE, - message.str() << argv[0] << std::endl); + cmCTestLog(this->CTest, ERROR_MESSAGE, message.str() << std::endl); return -1; } return retVal; |