SshDeviceProcess: Don't buffer stdOut and stdErr

It's already being buffered inside remoteProcess.

Change-Id: I5fd90df600454563342aaf142d21df28a404d9ba
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-01-28 13:55:58 +01:00
parent f529ec492c
commit 773f8a5bbe
2 changed files with 4 additions and 30 deletions

View File

@@ -58,8 +58,6 @@ public:
QProcess::ExitStatus exitStatus = QProcess::NormalExit;
DeviceProcessSignalOperation::Ptr killOperation;
QTimer killTimer;
QByteArray stdOut;
QByteArray stdErr;
int exitCode = -1;
enum State { Inactive, Connecting, Connected, ProcessRunning } state = Inactive;
@@ -163,16 +161,12 @@ QString SshDeviceProcess::errorString() const
QByteArray SshDeviceProcess::readAllStandardOutput()
{
const QByteArray data = d->stdOut;
d->stdOut.clear();
return data;
return d->remoteProcess.get() ? d->remoteProcess->readAllStandardOutput() : QByteArray();
}
QByteArray SshDeviceProcess::readAllStandardError()
{
const QByteArray data = d->stdErr;
d->stdErr.clear();
return data;
return d->remoteProcess.get() ? d->remoteProcess->readAllStandardError() : QByteArray();
}
qint64 SshDeviceProcess::processId() const
@@ -203,9 +197,9 @@ void SshDeviceProcess::handleConnected()
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::done,
this, &SshDeviceProcess::handleProcessFinished);
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::readyReadStandardOutput,
this, &SshDeviceProcess::handleStdout);
this, &QtcProcess::readyReadStandardOutput);
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::readyReadStandardError,
this, &SshDeviceProcess::handleStderr);
this, &QtcProcess::readyReadStandardError);
d->remoteProcess->start();
}
}
@@ -254,24 +248,6 @@ void SshDeviceProcess::handleProcessFinished(const QString &error)
emit finished();
}
void SshDeviceProcess::handleStdout()
{
QByteArray output = d->remoteProcess->readAllStandardOutput();
if (output.isEmpty())
return;
d->stdOut += output;
emit readyReadStandardOutput();
}
void SshDeviceProcess::handleStderr()
{
QByteArray output = d->remoteProcess->readAllStandardError();
if (output.isEmpty())
return;
d->stdErr += output;
emit readyReadStandardError();
}
void SshDeviceProcess::handleKillOperationFinished(const QString &errorMessage)
{
QTC_ASSERT(d->state == SshDeviceProcessPrivate::ProcessRunning, return);

View File

@@ -61,8 +61,6 @@ private:
void handleDisconnected();
void handleProcessStarted();
void handleProcessFinished(const QString &error);
void handleStdout();
void handleStderr();
void handleKillOperationFinished(const QString &errorMessage);
void handleKillOperationTimeout();