AbstractProcessStep: Don't read std channels on done

Since we are connected to process' readyRead signals
and perform readAll inside handlers, there is no need to
do it again inside process' done handler. It's guaranteed
that before process emits done() signal it emits readyRead
signals if new data appeared on any channel.

Remove processReadyReadStdOutput() and processReadyReadStdError()
helpers.

Change-Id: I7e921335e6410a26efd9619cbed8f5e6852d2cf2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2022-12-02 12:40:12 +01:00
parent dfd079f050
commit 51b6efb116
2 changed files with 6 additions and 20 deletions

View File

@@ -203,10 +203,12 @@ void AbstractProcessStep::doRun()
if (d->m_lowPriority && ProjectExplorerPlugin::projectExplorerSettings().lowBuildPriority)
d->m_process->setLowPriority();
connect(d->m_process.get(), &QtcProcess::readyReadStandardOutput,
this, &AbstractProcessStep::processReadyReadStdOutput);
connect(d->m_process.get(), &QtcProcess::readyReadStandardError,
this, &AbstractProcessStep::processReadyReadStdError);
connect(d->m_process.get(), &QtcProcess::readyReadStandardOutput, this, [this] {
stdOutput(d->stdoutStream->toUnicode(d->m_process->readAllStandardOutput()));
});
connect(d->m_process.get(), &QtcProcess::readyReadStandardError, this, [this] {
stdError(d->stderrStream->toUnicode(d->m_process->readAllStandardError()));
});
connect(d->m_process.get(), &QtcProcess::started,
this, &AbstractProcessStep::processStarted);
connect(d->m_process.get(), &QtcProcess::done,
@@ -324,12 +326,6 @@ void AbstractProcessStep::processStartupFailed()
finish(false);
}
void AbstractProcessStep::processReadyReadStdOutput()
{
QTC_ASSERT(d->m_process.get(), return);
stdOutput(d->stdoutStream->toUnicode(d->m_process->readAllStandardOutput()));
}
/*!
Called for each line of output on stdOut().
@@ -341,12 +337,6 @@ void AbstractProcessStep::stdOutput(const QString &output)
emit addOutput(output, BuildStep::OutputFormat::Stdout, BuildStep::DontAppendNewline);
}
void AbstractProcessStep::processReadyReadStdError()
{
QTC_ASSERT(d->m_process.get(), return);
stdError(d->stderrStream->toUnicode(d->m_process->readAllStandardError()));
}
/*!
Called for each line of output on StdErrror().
@@ -371,8 +361,6 @@ void AbstractProcessStep::handleProcessDone()
d->m_process.release()->deleteLater();
return;
}
stdError(d->stderrStream->toUnicode(d->m_process->readAllStandardError()));
stdOutput(d->stdoutStream->toUnicode(d->m_process->readAllStandardOutput()));
d->cleanUp(d->m_process->exitCode(), d->m_process->exitStatus());
}

View File

@@ -51,8 +51,6 @@ protected:
private:
virtual void processFinished(bool success);
void processReadyReadStdOutput();
void processReadyReadStdError();
void handleProcessDone();
class Private;