RsyncDeployService: Don't use SshRemoteProcess

Use QtcProcess with a path on device instead.

Change-Id: I0b5f3160926287112b7fe53dea19d54ca5c07232
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-05-03 00:38:11 +02:00
parent e9fb604812
commit a1b9619b5e

View File

@@ -29,6 +29,7 @@
#include "remotelinux_constants.h"
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
#include <ssh/sshconnection.h>
@@ -71,7 +72,7 @@ private:
bool m_ignoreMissingFiles = false;
QString m_flags;
QtcProcess m_rsync;
SshRemoteProcessPtr m_mkdir;
std::unique_ptr<QtcProcess> m_mkdir;
};
bool RsyncDeployService::isDeploymentNecessary() const
@@ -101,21 +102,19 @@ void RsyncDeployService::createRemoteDirectories()
remoteDirs << f.remoteDirectory();
remoteDirs.sort();
remoteDirs.removeDuplicates();
m_mkdir = connection()->createRemoteProcess("mkdir -p " +
ProcessArgs::createUnixArgs(remoteDirs).toString());
m_mkdir.reset(new QtcProcess);
const CommandLine command {deviceConfiguration()->mapToGlobalPath("mkdir"),
{"-p", ProcessArgs::createUnixArgs(remoteDirs).toString()}};
m_mkdir->setCommand(command);
connect(m_mkdir.get(), &QtcProcess::done, this, [this] {
QString userError;
const QString error = m_mkdir->errorString();
if (!error.isEmpty())
userError = error;
if (m_mkdir->exitCode() != 0)
userError = QString::fromUtf8(m_mkdir->readAllStandardError());
if (!userError.isEmpty()) {
emit errorMessage(tr("Failed to create remote directories: %1").arg(userError));
if (m_mkdir->result() != ProcessResult::FinishedWithSuccess) {
emit errorMessage(tr("Failed to create remote directories: %1")
.arg(QString::fromUtf8(m_mkdir->readAllStandardError())));
setFinished();
return;
}
deployFiles();
m_mkdir.release()->deleteLater();
});
m_mkdir->start();
}
@@ -173,12 +172,9 @@ void RsyncDeployService::deployNextFile()
void RsyncDeployService::setFinished()
{
if (m_mkdir) {
m_mkdir->disconnect();
m_mkdir->kill();
}
m_rsync.disconnect();
m_rsync.kill();
if (m_mkdir)
m_mkdir.release()->deleteLater();
m_rsync.close();
handleDeploymentDone();
}