mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 08:10:02 +02:00
removed exec_command from ClientInterface
This commit is contained in:
parent
540a203139
commit
4174d193b4
@ -108,7 +108,6 @@ void ClientInterface::startTCPServer() {
|
||||
|
||||
// clang-format off
|
||||
int ClientInterface::functionTable(){
|
||||
flist[F_EXEC_RECEIVER_COMMAND] = &ClientInterface::exec_command;
|
||||
flist[F_LOCK_RECEIVER] = &ClientInterface::lock_receiver;
|
||||
flist[F_GET_LAST_RECEIVER_CLIENT_IP] = &ClientInterface::get_last_client_ip;
|
||||
flist[F_SET_RECEIVER_PORT] = &ClientInterface::set_port;
|
||||
@ -271,28 +270,6 @@ void ClientInterface::verifyIdle(Interface &socket) {
|
||||
}
|
||||
}
|
||||
|
||||
int ClientInterface::exec_command(Interface &socket) {
|
||||
char cmd[MAX_STR_LENGTH]{};
|
||||
char retval[MAX_STR_LENGTH]{};
|
||||
socket.Receive(cmd);
|
||||
LOG(logINFO) << "Executing command (" << cmd << ")";
|
||||
const size_t tempsize = 256;
|
||||
std::array<char, tempsize> temp{};
|
||||
std::string sresult;
|
||||
std::shared_ptr<FILE> pipe(popen(cmd, "r"), pclose);
|
||||
if (!pipe) {
|
||||
throw RuntimeError("Executing Command failed\n");
|
||||
} else {
|
||||
while (!feof(pipe.get())) {
|
||||
if (fgets(temp.data(), tempsize, pipe.get()) != nullptr)
|
||||
sresult += temp.data();
|
||||
}
|
||||
strncpy(retval, sresult.c_str(), MAX_STR_LENGTH);
|
||||
LOG(logINFO) << "Result of cmd (" << cmd << "):\n" << retval;
|
||||
}
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::lock_receiver(Interface &socket) {
|
||||
auto lock = socket.Receive<int>();
|
||||
LOG(logDEBUG1) << "Locking Server to " << lock;
|
||||
|
@ -60,7 +60,6 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
void verifyLock();
|
||||
void verifyIdle(sls::ServerInterface &socket);
|
||||
|
||||
int exec_command(sls::ServerInterface &socket);
|
||||
int lock_receiver(sls::ServerInterface &socket);
|
||||
int get_last_client_ip(sls::ServerInterface &socket);
|
||||
int set_port(sls::ServerInterface &socket);
|
||||
|
Loading…
x
Reference in New Issue
Block a user