forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user