Skip to content

Commit a72d560

Browse files
committed
Fix treatment of multiple raw FMQ channels
1 parent 69bfa5f commit a72d560

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

Framework/Core/src/DeviceSpecHelpers.cxx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,19 @@ void DeviceSpecHelpers::prepareArguments(bool defaultQuiet, bool defaultStopped,
11331133
haveSessionArg = haveSessionArg || varmap.count("session") != 0;
11341134
useDefaultWS = useDefaultWS && ((varmap.count("driver-client-backend") == 0) || varmap["driver-client-backend"].as<std::string>() == "ws://");
11351135

1136+
auto processRawChannelConfig = [&tmpArgs](const std::string& conf) {
1137+
std::stringstream ss(conf);
1138+
std::string token;
1139+
while (std::getline(ss, token, ';')) { // split to tokens, trim spaces and add each non-empty one with channel-config options
1140+
token.erase(token.begin(), std::find_if(token.begin(), token.end(), [](int ch) { return !std::isspace(ch); }));
1141+
token.erase(std::find_if(token.rbegin(), token.rend(), [](int ch) { return !std::isspace(ch); }).base(), token.end());
1142+
if (!token.empty()) {
1143+
tmpArgs.emplace_back("--channel-config");
1144+
tmpArgs.emplace_back(token);
1145+
}
1146+
}
1147+
};
1148+
11361149
for (const auto varit : varmap) {
11371150
// find the option belonging to key, add if the option has been parsed
11381151
// and is not defaulted
@@ -1148,10 +1161,14 @@ void DeviceSpecHelpers::prepareArguments(bool defaultQuiet, bool defaultStopped,
11481161
assert(semantic->min_tokens() <= 1);
11491162
//assert(semantic->max_tokens() && semantic->min_tokens());
11501163
if (semantic->min_tokens() > 0) {
1151-
tmpArgs.emplace_back("--");
1152-
tmpArgs.back() += varit.first;
1153-
// add the token
1154-
tmpArgs.emplace_back(varit.second.as<std::string>());
1164+
if (varit.first == "channel-config") {
1165+
processRawChannelConfig(varit.second.as<std::string>());
1166+
} else {
1167+
tmpArgs.emplace_back("--");
1168+
tmpArgs.back() += varit.first;
1169+
// add the token
1170+
tmpArgs.emplace_back(varit.second.as<std::string>());
1171+
}
11551172
optarg = tmpArgs.back().c_str();
11561173
} else if (semantic->min_tokens() == 0 && varit.second.as<bool>()) {
11571174
tmpArgs.emplace_back("--");

0 commit comments

Comments
 (0)