Explorar o código

CTest: fix pre and post test commands with spaces

If the pre or post memcheck or test commands have spaces in the path these
were never escaped, leading to broken commands. This was not covered in the
test suite so it went unnoticed.
Rolf Eike Beer %!s(int64=13) %!d(string=hai) anos
pai
achega
6187876dea
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      Source/CTest/cmCTestTestHandler.cxx

+ 3 - 2
Source/CTest/cmCTestTestHandler.cxx

@@ -1304,9 +1304,10 @@ int cmCTestTestHandler::ExecuteCommands(std::vector<cmStdString>& vec)
   for ( it = vec.begin(); it != vec.end(); ++it )
     {
     int retVal = 0;
-    cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << *it
+    std::string cmd = cmSystemTools::ConvertToOutputPath(it->c_str());
+    cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Run command: " << cmd
       << std::endl);
-    if ( !cmSystemTools::RunSingleCommand(it->c_str(), 0, &retVal, 0,
+    if ( !cmSystemTools::RunSingleCommand(cmd.c_str(), 0, &retVal, 0,
                                           cmSystemTools::OUTPUT_MERGE
         /*this->Verbose*/) || retVal != 0 )
       {