forked from qt-creator/qt-creator
Port to Qt 6's absence of QProcess::setupChildProcess
Change-Id: I9709abb1c3734e10a7defffd1607e5b3fd46af0e Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -89,19 +89,27 @@ static Q_LOGGING_CATEGORY(processLog, "qtc.utils.synchronousprocess", QtWarningM
|
||||
// A special QProcess derivative allowing for terminal control.
|
||||
class TerminalControllingProcess : public QProcess {
|
||||
public:
|
||||
TerminalControllingProcess() = default;
|
||||
TerminalControllingProcess()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) && defined(Q_OS_UNIX)
|
||||
setChildProcessModifier([this]() { maybeSetsid(); });
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned flags() const { return m_flags; }
|
||||
void setFlags(unsigned tc) { m_flags = tc; }
|
||||
|
||||
protected:
|
||||
void setupChildProcess() override;
|
||||
inline void maybeSetsid();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0) && defined(Q_OS_UNIX)
|
||||
void setupChildProcess() override { maybeSetsid(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
unsigned m_flags = 0;
|
||||
};
|
||||
|
||||
void TerminalControllingProcess::setupChildProcess()
|
||||
inline void TerminalControllingProcess::maybeSetsid()
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
// Disable terminal by becoming a session leader.
|
||||
|
||||
Reference in New Issue
Block a user