1
0
mirror of synced 2024-12-28 07:23:05 +01:00
ImHex/lib/libimhex/source/helpers/utils_linux.cpp

28 lines
612 B
C++
Raw Normal View History

#if defined(OS_LINUX)
2023-11-10 20:47:08 +01:00
#include <hex/helpers/logger.hpp>
2023-11-10 20:47:08 +01:00
#include <vector>
#include <string>
#include <unistd.h>
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