diff options
Diffstat (limited to 'ui/qt5/runner')
-rw-r--r-- | ui/qt5/runner/executepage.cc | 3 | ||||
-rw-r--r-- | ui/qt5/runner/executorprocess.cc | 20 | ||||
-rw-r--r-- | ui/qt5/runner/executorprocess.hh | 25 |
3 files changed, 47 insertions, 1 deletions
diff --git a/ui/qt5/runner/executepage.cc b/ui/qt5/runner/executepage.cc index 0d0980a..ce69c5e 100644 --- a/ui/qt5/runner/executepage.cc +++ b/ui/qt5/runner/executepage.cc @@ -13,6 +13,7 @@ #include "executepage.hh" #include "executorwizard.hh" +#include "executorprocess.hh" #include <QAbstractButton> #include <QGridLayout> @@ -53,7 +54,7 @@ ExecutePage::ExecutePage(QWidget *parent) : HorizonWizardPage(parent) { this->current = Prepare; markRunning(this->current); - executor = new QProcess(this); + executor = new ExecutorProcess(this); executor->setProgram("hscript-executor"); connect(executor, &QProcess::readyReadStandardError, this, &ExecutePage::executorReady); diff --git a/ui/qt5/runner/executorprocess.cc b/ui/qt5/runner/executorprocess.cc new file mode 100644 index 0000000..1712fd9 --- /dev/null +++ b/ui/qt5/runner/executorprocess.cc @@ -0,0 +1,20 @@ +/* + * executorprocess.cc - Implementation of the QProcess class for the executor + * horizon-run-qt5, the Qt 5 executor user interface for + * Project Horizon + * + * Copyright (c) 2023 Adélie Linux and contributors. All rights reserved. + * This code is licensed under the AGPL 3.0 license, as noted in the + * LICENSE-code file in the root directory of this repository. + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +#include "executorprocess.hh" + +#include <unistd.h> + +void ExecutorProcess::setupChildProcess() { + ::setuid(::geteuid()); + ::setgid(::getegid()); +} diff --git a/ui/qt5/runner/executorprocess.hh b/ui/qt5/runner/executorprocess.hh new file mode 100644 index 0000000..bec1d18 --- /dev/null +++ b/ui/qt5/runner/executorprocess.hh @@ -0,0 +1,25 @@ +/* + * executorprocess.hh - Definition of the QProcess class for the executor + * horizon-run-qt5, the Qt 5 executor user interface for + * Project Horizon + * + * Copyright (c) 2023 Adélie Linux and contributors. All rights reserved. + * This code is licensed under the AGPL 3.0 license, as noted in the + * LICENSE-code file in the root directory of this repository. + * + * SPDX-License-Identifier: AGPL-3.0-only + */ + +#ifndef EXECUTORPROCESS_HH +#define EXECUTORPROCESS_HH + +#include <QProcess> + +class ExecutorProcess : public QProcess { +public: + ExecutorProcess(QObject *parent = nullptr) : QProcess(parent) {}; +protected: + void setupChildProcess() override; +}; + +#endif /* !ERRORPAGE_HH */ |