aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/utils/processutils.h
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2021-08-09 14:01:14 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2021-08-09 14:38:43 +0000
commitb80624611bf61e88ec98d6f687129e36d2b5d841 (patch)
treea9a727464883e588de305a0a8b20a7a96bfc28ea /src/libs/utils/processutils.h
parent4e06d3ac74de6973718468d705e11804eb34ce2e (diff)
Reuse ProcessHelper in process launcher
Handle lowPriority and unixTerminalDisabled inside process launcher. Change-Id: I7a8998e303da0e79186c1201fc6e1a76edb4e1b3 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/libs/utils/processutils.h')
-rw-r--r--src/libs/utils/processutils.h29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/libs/utils/processutils.h b/src/libs/utils/processutils.h
index 27736afac4a..df176f1d959 100644
--- a/src/libs/utils/processutils.h
+++ b/src/libs/utils/processutils.h
@@ -26,10 +26,7 @@
#pragma once
#include <QIODevice>
-
-QT_BEGIN_NAMESPACE
-class QProcess;
-QT_END_NAMESPACE
+#include <QProcess>
namespace Utils {
@@ -54,6 +51,30 @@ private:
QByteArray m_writeData;
};
+class ProcessHelper : public QProcess
+{
+public:
+ ProcessHelper(QObject *parent = nullptr) : QProcess(parent)
+ {
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined(Q_OS_UNIX)
+ setChildProcessModifier([this] { setupChildProcess_impl(); });
+#endif
+ }
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ void setupChildProcess() override { setupChildProcess_impl(); }
+#endif
+
+ using QProcess::setErrorString;
+
+ void setLowPriority() { m_lowPriority = true; }
+ void setUnixTerminalDisabled() { m_unixTerminalDisabled = true; }
+
+private:
+ void setupChildProcess_impl();
+ bool m_lowPriority = false;
+ bool m_unixTerminalDisabled = false;
+};
} // namespace Utils