Skip to content
Snippets Groups Projects
Commit 98180e70 authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

fixed split_arg adding a wrong argument when ',' found without value

parent ba6bd3be
No related branches found
No related tags found
1 merge request!243M300433/fix split args
......@@ -93,7 +93,16 @@ ProcessManager::buildProcessTree(std::vector<std::shared_ptr<Node>> roots)
Debug(PROCESS, "Building process Tree");
std::shared_ptr<Node> node = roots[0]->isFile ? roots[0]->children[0] : roots[0];
auto first_process = create_process(node->oper, split_args(node->arguments));
std::shared_ptr<Process> first_process;
try
{
first_process = create_process(node->oper, split_args(node->arguments));
}
catch (std::runtime_error &e)
{
cdo_abort("%s: %s",node->oper,e.what());
}
if (node->numOut() == IS_OBASE)
{
Debug(PROCESS, "Setting obase for %s", node->oper);
......
......@@ -60,8 +60,7 @@ split_args(std::string operatorArguments)
{
auto new_arg = operatorArguments.substr(arg_start, pos - arg_start);
auto escape_pos = new_arg.find("\\,");
if (escape_pos != std::string::npos) {
new_arg.replace(escape_pos, 2, ","); }
if (escape_pos != std::string::npos) { new_arg.replace(escape_pos, 2, ","); }
argument_vector.push_back(new_arg);
Debug(ARGUMENTS, "added argument %s", argument_vector.back());
arg_start = pos + 1;
......@@ -73,6 +72,7 @@ split_args(std::string operatorArguments)
}
pos_start = pos + 1;
}
if (arg_start == operatorArguments.size()) { throw std::runtime_error("',' is not followed by any operator argument"); }
argument_vector.push_back(operatorArguments.substr(arg_start, operatorArguments.size() - arg_start));
Debug(ARGUMENTS, "added argument %s", argument_vector.back());
return argument_vector;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment