summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorRolf Eike Beer <eb@emlix.com>2017-09-13 13:32:47 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2017-09-15 15:50:56 (GMT)
commit69fac3c3d554a285b6171648a77cdba0974cb109 (patch)
treea6ba52bdcc911077058764f065a2dbde4e557271 /Source/cmCTest.cxx
parentc0c5f924fe46fcf83603117689b372cb8520c4bb (diff)
downloadCMake-69fac3c3d554a285b6171648a77cdba0974cb109.zip
CMake-69fac3c3d554a285b6171648a77cdba0974cb109.tar.gz
CMake-69fac3c3d554a285b6171648a77cdba0974cb109.tar.bz2
pass arguments as vector to cmCTest::RunCommand()
The only 2 callers took care to construct a properly escaped string, but not using the documented way, and that string was passed only to be immediately split into tokens again. Start with a vector and join it only for logging, avoiding needless quotes during that.
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx16
1 files changed, 5 insertions, 11 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 1325fd3..bcc45ce 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -2565,24 +2565,18 @@ bool cmCTest::SetCTestConfigurationFromCMakeVariable(
return true;
}
-bool cmCTest::RunCommand(const char* command, std::string* stdOut,
- std::string* stdErr, int* retVal, const char* dir,
- double timeout, Encoding encoding)
+bool cmCTest::RunCommand(std::vector<std::string> const& args,
+ std::string* stdOut, std::string* stdErr, int* retVal,
+ const char* dir, double timeout, Encoding encoding)
{
- std::vector<std::string> args = cmSystemTools::ParseArguments(command);
-
- if (args.empty()) {
- return false;
- }
-
std::vector<const char*> argv;
for (std::string const& a : args) {
argv.push_back(a.c_str());
}
argv.push_back(nullptr);
- *stdOut = "";
- *stdErr = "";
+ stdOut->clear();
+ stdErr->clear();
cmsysProcess* cp = cmsysProcess_New();
cmsysProcess_SetCommand(cp, &*argv.begin());