summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-01-20 13:45:55 (GMT)
committerBrad King <brad.king@kitware.com>2016-01-20 13:55:23 (GMT)
commit1787269ef3c476ee1176c92c54e5b22f9cb7f3fe (patch)
tree7d57e297ec9ac6f2a5aa650042b50bfaebd48412 /Source/cmcmd.cxx
parentd8bced813cdd0c3eb7c2e3e150f513da04ded513 (diff)
downloadCMake-1787269ef3c476ee1176c92c54e5b22f9cb7f3fe.zip
CMake-1787269ef3c476ee1176c92c54e5b22f9cb7f3fe.tar.gz
CMake-1787269ef3c476ee1176c92c54e5b22f9cb7f3fe.tar.bz2
cmake: Fix `-E time` argument passing to child
Since this command was introduced in 2002 it has incorrectly constructed the child process command line by concatenating arguments separated by spaces with no quoting. Fix this by passing the command argument vector directly to RunSingleCommand without an intermediate quoting and re-parsing step. Reported-by: Andrey Pokrovskiy <wonder.mice@gmail.com>
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 8dd902b..1dc304c 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -554,7 +554,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// Clock command
else if (args[1] == "time" && args.size() > 2)
{
- std::string command = cmJoin(cmMakeRange(args).advance(2), " ");
+ std::vector<std::string> command(args.begin()+2, args.end());
clock_t clock_start, clock_finish;
time_t time_start, time_finish;
@@ -562,7 +562,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
time(&time_start);
clock_start = clock();
int ret =0;
- cmSystemTools::RunSingleCommand(command.c_str(), 0, 0, &ret);
+ cmSystemTools::RunSingleCommand(command, 0, 0, &ret);
clock_finish = clock();
time(&time_finish);