Skip to content

Commit

Permalink
ProcessX::startCommand(): Prepend flatpak-spawn --host to build com… (
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Wilms authored Feb 17, 2024
1 parent eac918d commit e81785b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/buildmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2372,11 +2372,38 @@ void ProcessX::startCommand()
emit finished(0, NormalExit);
return;
}

if (stdoutEnabled || stdoutBuffer)
connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(readFromStandardOutput()));
if (stderrEnabled)
connect(this, SIGNAL(readyReadStandardError()), this, SLOT(readFromStandardError()));

#ifdef Q_OS_LINUX
// Retrieve the environment variables
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();

// Check if FLATPAK_SANDBOX_DIR is set
if (env.contains("FLATPAK_SANDBOX_DIR")) {
if (!cmd.startsWith("flatpak-spawn")) {
QStringList cmd_elements = cmd.split(" ");

if (!cmd_elements.isEmpty()) {
QDir texlive_flatpak_dir("/app/texlive/bin");
QString executable = cmd_elements.first();

QString executable_path = texlive_flatpak_dir.filePath(executable);

// Check if the executable exists
QFileInfo fileInfo(executable_path);
if (fileInfo.isFile() and executable.indexOf("/") == -1) {
// don't change cmd
} else {
cmd = "flatpak-spawn --host "+cmd;
}
}
}
}
#endif
ExecProgram execProgram(cmd, BuildManager::resolvePaths(BuildManager::additionalSearchPaths));
execProgram.execAndNoWait(*this);

Expand Down

0 comments on commit e81785b

Please sign in to comment.