Utils: Remove couple of functions from QtcProcess

Some functions do not work and should therefore not be used.
Line-based processing of the output interferes with the internal
automatic usage of the ChannelBuffers.
Remove the respective functions and move the line parsing over
to the client.

Change-Id: Iaaa58c181e35e132fae863ddb808547142c99221
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2021-06-03 15:20:18 +02:00
parent 2192415483
commit 4f0759d7ea
5 changed files with 20 additions and 34 deletions

View File

@@ -700,16 +700,6 @@ QByteArray QtcProcess::readAllStandardError()
return buf;
}
QByteArray QtcProcess::readAll()
{
return d->m_process->readAll();
}
QByteArray QtcProcess::readLine()
{
return d->m_process->readLine();
}
QProcess::ExitStatus QtcProcess::exitStatus() const
{
return d->m_process->exitStatus();
@@ -735,16 +725,6 @@ void QtcProcess::close()
d->m_process->close();
}
void QtcProcess::setReadChannel(QProcess::ProcessChannel channel)
{
d->m_process->setReadChannel(channel);
}
bool QtcProcess::canReadLine() const
{
return d->m_process->canReadLine();
}
QString QtcProcess::locateBinary(const QString &binary)
{
const QByteArray path = qgetenv("PATH");

View File

@@ -161,8 +161,6 @@ public:
QByteArray readAllStandardOutput();
QByteArray readAllStandardError();
QByteArray readAll();
QByteArray readLine();
QProcess::ExitStatus exitStatus() const;
@@ -171,8 +169,6 @@ public:
qint64 write(const QByteArray &input);
void closeWriteChannel();
void close();
void setReadChannel(QProcess::ProcessChannel channel);
bool canReadLine() const;
QIODevice *ioDevice(); // FIXME: Remove.

View File

@@ -527,12 +527,17 @@ QWidget *AndroidDeployQtStep::createConfigWidget()
void AndroidDeployQtStep::processReadyReadStdOutput(DeployErrorCode &errorCode)
{
m_process->setReadChannel(QProcess::StandardOutput);
while (m_process->canReadLine()) {
QString line = QString::fromLocal8Bit(m_process->readLine());
const QByteArray output = m_process->readAllStandardOutput();
int start = 0;
int end;
do {
end = output.indexOf('\n', start);
QString line = QString::fromLocal8Bit(output.mid(start, end - start));
errorCode |= parseDeployErrors(line);
stdOutput(line);
}
start = end + 1;
} while (end >= 0);
}
void AndroidDeployQtStep::stdOutput(const QString &line)
@@ -542,12 +547,17 @@ void AndroidDeployQtStep::stdOutput(const QString &line)
void AndroidDeployQtStep::processReadyReadStdError(DeployErrorCode &errorCode)
{
m_process->setReadChannel(QProcess::StandardError);
while (m_process->canReadLine()) {
QString line = QString::fromLocal8Bit(m_process->readLine());
const QByteArray output = m_process->readAllStandardError();
int start = 0;
int end;
do {
end = output.indexOf('\n', start);
QString line = QString::fromLocal8Bit(output.mid(start, end - start));
errorCode |= parseDeployErrors(line);
stdError(line);
}
start = end + 1;
} while (end >= 0);
}
void AndroidDeployQtStep::stdError(const QString &line)

View File

@@ -174,7 +174,7 @@ void ClangToolRunner::onProcessError(QProcess::ProcessError error)
void ClangToolRunner::onProcessOutput()
{
m_processOutput.append(m_process->readAll());
m_processOutput.append(m_process->readAllStandardOutput());
}
QString ClangToolRunner::commandlineAndOutput() const

View File

@@ -84,7 +84,7 @@ void DockerSettings::updateImageList()
process.setCommand({"docker", {"search", imageListFilter.value()}});
connect(&process, &QtcProcess::finished, this, [&process, this] {
const QString data = QString::fromUtf8(process.readAll());
const QString data = QString::fromUtf8(process.readAllStandardOutput());
imageList.setValue(data);
});