ENH: Fix argument parsing on UNIX with spaces
This commit is contained in:
parent
2c33b3db65
commit
d86d2fdf12
@ -308,7 +308,7 @@ bool cmSystemTools::RunSingleCommand(
|
|||||||
|
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
std::string arg;
|
std::string arg;
|
||||||
|
|
||||||
// Split the command into an argv array.
|
// Split the command into an argv array.
|
||||||
for(const char* c = command; *c;)
|
for(const char* c = command; *c;)
|
||||||
{
|
{
|
||||||
@ -350,8 +350,20 @@ bool cmSystemTools::RunSingleCommand(
|
|||||||
// Parse an unquoted argument.
|
// Parse an unquoted argument.
|
||||||
while(*c && *c != ' ' && *c != '\t')
|
while(*c && *c != ' ' && *c != '\t')
|
||||||
{
|
{
|
||||||
arg.append(1, *c);
|
if(*c == '\\')
|
||||||
++c;
|
{
|
||||||
|
++c;
|
||||||
|
if(*c)
|
||||||
|
{
|
||||||
|
arg.append(1, *c);
|
||||||
|
++c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
arg.append(1, *c);
|
||||||
|
++c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
args.push_back(arg);
|
args.push_back(arg);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user