2023-07-05 20:50:46 +02:00
|
|
|
#if defined(OS_LINUX)
|
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
#include <hex/helpers/logger.hpp>
|
2023-07-05 20:50:46 +02:00
|
|
|
|
2023-11-10 20:47:08 +01:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <unistd.h>
|
2023-07-05 20:50:46 +02:00
|
|
|
|
|
|
|
namespace hex {
|
|
|
|
|
|
|
|
void executeCmd(const std::vector<std::string> &argsVector) {
|
|
|
|
std::vector<char*> cArgsVector;
|
|
|
|
for (const auto &str : argsVector) {
|
|
|
|
cArgsVector.push_back(const_cast<char*>(str.c_str()));
|
|
|
|
}
|
|
|
|
cArgsVector.push_back(nullptr);
|
|
|
|
|
|
|
|
if (fork() == 0) {
|
|
|
|
execvp(cArgsVector[0], &cArgsVector[0]);
|
|
|
|
log::error("execvp() failed: {}", strerror(errno));
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|