reset read vec values, add getter function
This commit is contained in:
parent
dafcaa6007
commit
d1ff32bf96
@ -32,6 +32,8 @@ ReturnValue_t CommandExecutor::execute() {
|
|||||||
} else if (state == States::PENDING) {
|
} else if (state == States::PENDING) {
|
||||||
return COMMAND_PENDING;
|
return COMMAND_PENDING;
|
||||||
}
|
}
|
||||||
|
// Reset data in read vector
|
||||||
|
std::memset(readVec.data(), 0, readVec.size());
|
||||||
currentCmdFile = popen(currentCmd.c_str(), "r");
|
currentCmdFile = popen(currentCmd.c_str(), "r");
|
||||||
if (currentCmdFile == nullptr) {
|
if (currentCmdFile == nullptr) {
|
||||||
lastError = errno;
|
lastError = errno;
|
||||||
@ -205,3 +207,7 @@ ReturnValue_t CommandExecutor::executeBlocking() {
|
|||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<char>& CommandExecutor::getReadVector() const {
|
||||||
|
return readVec;
|
||||||
|
}
|
||||||
|
@ -109,6 +109,8 @@ class CommandExecutor {
|
|||||||
*/
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
const std::vector<char>& getReadVector() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string currentCmd;
|
std::string currentCmd;
|
||||||
bool blocking = true;
|
bool blocking = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user