From 773f8a5bbe8b5cdbdd103bd429510c4a8ca0f09a Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Fri, 28 Jan 2022 13:55:58 +0100 Subject: [PATCH] SshDeviceProcess: Don't buffer stdOut and stdErr It's already being buffered inside remoteProcess. Change-Id: I5fd90df600454563342aaf142d21df28a404d9ba Reviewed-by: hjk --- .../devicesupport/sshdeviceprocess.cpp | 32 +++---------------- .../devicesupport/sshdeviceprocess.h | 2 -- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp index eb0b7b9584a..e496ffaa322 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp @@ -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); diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.h b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.h index 8c1da7cf558..0980d530bcf 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.h +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.h @@ -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();