systemctl helper #596

Merged
meggert merged 5 commits from feature_systemctl_helper into develop 2023-04-14 08:25:10 +02:00
7 changed files with 79 additions and 27 deletions
Showing only changes of commit bc6531f7a5 - Show all commits

View File

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

View File

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

2
tmtc

Submodule tmtc updated: 005e15b21b...f8da9cff7c