bugfix for shell cmd executors
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-04-14 00:29:21 +02:00
parent e17b8d2ec4
commit bc6531f7a5
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 7 additions and 5 deletions

View File

@ -25,6 +25,7 @@ will consitute of a breaking change warranting a new major release:
bytes were not written properly.
- Bugfix for STR where an invalid reply was received for special requests
like firmware updates.
- Bugfix for shell command executors in command controller which lead to a crash.
## Added

View File

@ -369,20 +369,21 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
return actionReboot(data, size);
}
case (EXECUTE_SHELL_CMD_BLOCKING): {
std::string cmd = std::string(cmd, size);
int result = std::system(cmd.c_str());
std::string cmdToExecute = std::string(reinterpret_cast<const char*>(data), size);
int result = std::system(cmdToExecute.c_str());
if (result != 0) {
// TODO: Data reply with returnalue maybe?
return returnvalue::FAILED;
}
return EXECUTION_FINISHED;
}
case (EXECUTE_SHELL_CMD_NON_BLOCKING): {
std::string cmd = std::string(cmd, size);
std::string cmdToExecute = std::string(reinterpret_cast<const char*>(data), size);
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING or
shellCmdIsExecuting) {
return HasActionsIF::IS_BUSY;
}
cmdExecutor.load(cmd, false, false);
cmdExecutor.load(cmdToExecute, false, false);
ReturnValue_t result = cmdExecutor.execute();
if (result != returnvalue::OK) {
return result;

2
tmtc

@ -1 +1 @@
Subproject commit 005e15b21bdb58109b90ffbe4be9fc76e85ca38f
Subproject commit f8da9cff7c5d6d6bdd483f90ccefb67b2d1e11a4