impr: Use execvp() instead of system() on Linux (#1170)

This PR it just a hack to fix #1160 , it doesn't solve the underlying
problem.

It fixes the problem because by using execvp() directly, it avoids the
call to `sh` done with `system()`, which has a bug on Ubuntu 22.04 which
makes it i,compatibles with the glibc inside the AppImage.
It doesn't fix the underlying problem because the programs we call
themselves still link to the AppImage's libraries instead of the system
ones.
This commit is contained in:
iTrooz
2023-07-05 20:50:46 +02:00
committed by GitHub
parent e3ae169833
commit ac2a609d0a
6 changed files with 47 additions and 30 deletions

View File

@@ -7,6 +7,7 @@
#include <hex/api/event.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/utils_linux.hpp>
#include <hex/helpers/logger.hpp>
#include <wolv/utils/core.hpp>
@@ -37,20 +38,6 @@ namespace hex {
return false;
}
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);
}
}
void nativeErrorMessage(const std::string &message) {
log::fatal(message);
if (isFileInPath("zenity")) {