shell: fix mingw build

pull/1290/head
flightlessmango 4 weeks ago
parent 3c743a9e92
commit 325498d1d6

@ -1658,11 +1658,13 @@ void HudElements::legacy_elements(){
}
void HudElements::update_exec(){
#ifdef __LINUX__
if (!HUDElements.shell)
HUDElements.shell = std::make_unique<Shell>();
for(auto& item : exec_list)
item.ret = HUDElements.shell->exec(item.value + "\n");
#endif
}
HudElements HUDElements;

@ -54,7 +54,9 @@ class HudElements{
int refresh = 0;
std::unique_ptr<WineSync> winesync_ptr = nullptr;
std::unique_ptr<Net> net = nullptr;
#ifdef __LINUX__
std::unique_ptr<Shell> shell = nullptr;
#endif
void sort_elements(const std::pair<std::string, std::string>& option);
void legacy_elements();

@ -2,7 +2,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <cstring>
#ifdef __LINUX__
#include <sys/wait.h>
#endif
#include <string>
#include <memory>
@ -12,10 +14,12 @@ private:
int from_shell[2];
pid_t shell_pid;
#ifdef __LINUX__
void setNonBlocking(int fd) {
int flags = fcntl(fd, F_GETFL, 0);
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
}
#endif
void writeCommand(const std::string& command) {
write(to_shell[1], command.c_str(), command.length());

Loading…
Cancel
Save