1
0
mirror of synced 2024-11-28 09:30:51 +01:00

fix: fix forwarding multiple arguments to subcommands (#1388)

This commit is contained in:
iTrooz 2023-10-24 09:59:23 +02:00 committed by GitHub
parent 58189e5403
commit 4f2d14e220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,9 +94,13 @@ namespace hex::subcommands {
void forwardSubCommand(const std::string &cmdName, const std::vector<std::string> &args) {
log::debug("Forwarding subcommand {} (maybe to us)", cmdName);
std::string dataStr = std::accumulate(args.begin(), args.end(), std::string("\0"));
std::vector<u8> data(dataStr.begin(), dataStr.end());
std::vector<u8> data;
for (const auto &arg: args) {
data.insert(data.end(), arg.begin(), arg.end());
data.push_back('\0');
}
data.erase(data.end()-1);
EventManager::post<SendMessageToMainInstance>(hex::format("command/{}", cmdName), data);
}