Put quotes around arguments if they have spaces and no quotes
This commit is contained in:
parent
4918ce6593
commit
ffe1132407
@ -25,12 +25,24 @@ int main (int argc, char *argv[])
|
|||||||
std::cerr << "Usage: " << argv[0] << " executable" << std::endl;
|
std::cerr << "Usage: " << argv[0] << " executable" << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
std::string command = argv[1];
|
std::string arg = argv[1];
|
||||||
|
if ( (arg.find_first_of(" ") != arg.npos) &&
|
||||||
|
(arg.find_first_of("\"") == arg.npos) )
|
||||||
|
{
|
||||||
|
arg = "\"" + arg + "\"";
|
||||||
|
}
|
||||||
|
std::string command = arg;
|
||||||
int cc;
|
int cc;
|
||||||
for ( cc = 2; cc < argc; cc ++ )
|
for ( cc = 2; cc < argc; cc ++ )
|
||||||
{
|
{
|
||||||
|
std::string arg = argv[cc];
|
||||||
|
if ( (arg.find_first_of(" ") != arg.npos) &&
|
||||||
|
(arg.find_first_of("\"") == arg.npos) )
|
||||||
|
{
|
||||||
|
arg = "\"" + arg + "\"";
|
||||||
|
}
|
||||||
command += " ";
|
command += " ";
|
||||||
command += argv[cc];
|
command += arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmWin32ProcessExecution::Windows9xHack(command.c_str());
|
return cmWin32ProcessExecution::Windows9xHack(command.c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user