mirror of
https://github.com/flightlessmango/MangoHud.git
synced 2024-11-11 19:10:55 +00:00
shell: edit the command if steam runtime
Inside steam runtime we should use `steam-runtime-launch-client --alongside-steam --host` This should resolve issues where the user tries to use commands that don't exist inside the runtime
This commit is contained in:
parent
159eb13341
commit
c0afb84e9c
@ -29,6 +29,9 @@ std::string Shell::readOutput() {
|
||||
}
|
||||
|
||||
Shell::Shell() {
|
||||
if (stat("/run/pressure-vessel", &stat_buffer) == 0)
|
||||
runtime = true;
|
||||
|
||||
static bool failed;
|
||||
if (pipe(to_shell) == -1) {
|
||||
SPDLOG_ERROR("Failed to create to_shell pipe: {}", strerror(errno));
|
||||
@ -79,6 +82,9 @@ void Shell::writeCommand(std::string command) {
|
||||
if (write(to_shell[1], command.c_str(), command.length()) == -1)
|
||||
SPDLOG_ERROR("Failed to write to shell");
|
||||
|
||||
if (runtime)
|
||||
command = "steam-runtime-launch-client --alongside-steam --host -- " + command;
|
||||
|
||||
trim(command);
|
||||
SPDLOG_DEBUG("Shell: wrote command: {}", command);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#endif
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <sys/stat.h>
|
||||
|
||||
class Shell {
|
||||
private:
|
||||
@ -14,6 +15,8 @@ private:
|
||||
int from_shell[2];
|
||||
pid_t shell_pid;
|
||||
bool success;
|
||||
struct stat stat_buffer;
|
||||
bool runtime = false;
|
||||
|
||||
#ifdef __linux__
|
||||
void setNonBlocking(int fd) {
|
||||
|
Loading…
Reference in New Issue
Block a user