Revert "Port to Qt 6's absence of QProcess::setupChildProcess"

This reverts commit 6a66ced594.

The patch that will introduce the alternative to setupChildProcess
(QProcess::setChildProcessModifier()) has not yet found its
way to qtbase and current Qt dev already identifies itself as
version 6.0.0, rendering the code here uncompilable.

Change-Id: I570b01598005070f0c17604226d245a3a381250e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-06-11 14:59:40 +02:00
parent 9e4eafccd2
commit f2e06d2764
5 changed files with 6 additions and 40 deletions

View File

@@ -678,10 +678,6 @@ QtcProcess::QtcProcess(QObject *parent)
static int qProcessProcessErrorMeta = qRegisterMetaType<QProcess::ProcessError>();
Q_UNUSED(qProcessExitStatusMeta)
Q_UNUSED(qProcessProcessErrorMeta)
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) && defined(Q_OS_UNIX)
setChildProcessModifier([this]() { niceChildProcess(); });
#endif
}
void QtcProcess::setUseCtrlCStub(bool enabled)
@@ -1224,25 +1220,18 @@ QString QtcProcess::expandMacros(const QString &str, AbstractMacroExpander *mx,
return ret;
}
#if defined Q_OS_UNIX
void QtcProcess::niceChildProcess()
void QtcProcess::setupChildProcess()
{
#if defined Q_OS_UNIX
// nice value range is -20 to +19 where -20 is highest, 0 default and +19 is lowest
if (m_lowPriority) {
errno = 0;
if (::nice(5) == -1 && errno != 0)
perror("Failed to set nice value");
}
}
# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
void QtcProcess::setupChildProcess()
{
niceChildProcess();
#endif
QProcess::setupChildProcess();
}
# endif
#endif
bool QtcProcess::ArgIterator::next()
{