reset read vec values, add getter function

This commit is contained in:
Robin Müller 2022-05-11 16:12:24 +02:00
parent dafcaa6007
commit d1ff32bf96
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,8 @@ ReturnValue_t CommandExecutor::execute() {
} else if (state == States::PENDING) {
return COMMAND_PENDING;
}
// Reset data in read vector
std::memset(readVec.data(), 0, readVec.size());
currentCmdFile = popen(currentCmd.c_str(), "r");
if (currentCmdFile == nullptr) {
lastError = errno;
@ -205,3 +207,7 @@ ReturnValue_t CommandExecutor::executeBlocking() {
}
return HasReturnvaluesIF::RETURN_OK;
}
const std::vector<char>& CommandExecutor::getReadVector() const {
return readVec;
}

View File

@ -109,6 +109,8 @@ class CommandExecutor {
*/
void reset();
const std::vector<char>& getReadVector() const;
private:
std::string currentCmd;
bool blocking = true;