summaryrefslogtreecommitdiff
path: root/src/plugins/remotelinux
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-05-21 16:59:29 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-05-24 09:08:49 +0000
commit0a555018d1dda0aafff358774af2b564483a8c1e (patch)
tree657403526e058ab335f19b28e7283a86b2ac0810 /src/plugins/remotelinux
parentbe0d7aa3e94969234ebf4ba1ae552e973e7b6588 (diff)
downloadqt-creator-0a555018d1dda0aafff358774af2b564483a8c1e.tar.gz
SSH: Pass remote command as QString
The old implementation sent the command over the wire as-is, so we declared it as a QByteArray and let the caller choose the encoding. This doesn't make sense anymore, as the command is now passed to an external process as a QString anyway. Change-Id: Ib84bc0f871db2b45b93f71d924c4177cc28d3bb0 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/remotelinux')
-rw-r--r--src/plugins/remotelinux/genericdirectuploadservice.cpp5
-rw-r--r--src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp2
-rw-r--r--src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp2
-rw-r--r--src/plugins/remotelinux/remotelinuxpackageinstaller.cpp4
-rw-r--r--src/plugins/remotelinux/remotelinuxsignaloperation.cpp2
-rw-r--r--src/plugins/remotelinux/rsyncdeploystep.cpp2
-rw-r--r--src/plugins/remotelinux/sshkeydeployer.cpp5
7 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp
index 014ed5db62..84779d373e 100644
--- a/src/plugins/remotelinux/genericdirectuploadservice.cpp
+++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp
@@ -238,8 +238,7 @@ void GenericDirectUploadService::queryFiles()
continue;
}
// We'd like to use --format=%Y, but it's not supported by busybox.
- const QByteArray statCmd = "stat -t "
- + Utils::QtcProcess::quoteArgUnix(file.remoteFilePath()).toUtf8();
+ const QString statCmd = "stat -t " + Utils::QtcProcess::quoteArgUnix(file.remoteFilePath());
SshRemoteProcess * const statProc = connection()->createRemoteProcess(statCmd).release();
statProc->setParent(this);
connect(statProc, &SshRemoteProcess::done, this,
@@ -328,7 +327,7 @@ void GenericDirectUploadService::chmod()
const QString command = QLatin1String("chmod a+x ")
+ Utils::QtcProcess::quoteArgUnix(f.remoteFilePath());
SshRemoteProcess * const chmodProc
- = connection()->createRemoteProcess(command.toUtf8()).release();
+ = connection()->createRemoteProcess(command).release();
chmodProc->setParent(this);
connect(chmodProc, &SshRemoteProcess::done, this,
[this, chmodProc, state = d->state](const QString &error) {
diff --git a/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp b/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp
index 8b1fb6dfe8..e1d2447c51 100644
--- a/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp
+++ b/src/plugins/remotelinux/remotelinuxcheckforfreediskspaceservice.cpp
@@ -122,7 +122,7 @@ void RemoteLinuxCheckForFreeDiskSpaceService::doDeploy()
this, &RemoteLinuxCheckForFreeDiskSpaceService::handleStdErr);
const QString command = QString::fromLatin1("df -k %1 |tail -n 1 |sed 's/ */ /g' "
"|cut -d ' ' -f 4").arg(d->pathToCheck);
- d->processRunner->run(command.toUtf8(), deviceConfiguration()->sshParameters());
+ d->processRunner->run(command, deviceConfiguration()->sshParameters());
}
void RemoteLinuxCheckForFreeDiskSpaceService::stopDeployment()
diff --git a/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp b/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp
index c385f2a4ba..471ace1a0e 100644
--- a/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp
+++ b/src/plugins/remotelinux/remotelinuxcustomcommanddeployservice.cpp
@@ -91,7 +91,7 @@ void RemoteLinuxCustomCommandDeployService::doDeploy()
emit progressMessage(tr("Starting remote command \"%1\"...").arg(d->commandLine));
d->state = Running;
- d->runner->run(d->commandLine.toUtf8(), deviceConfiguration()->sshParameters());
+ d->runner->run(d->commandLine, deviceConfiguration()->sshParameters());
}
void RemoteLinuxCustomCommandDeployService::stopDeployment()
diff --git a/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp
index 4d3439931b..bf27f6d03e 100644
--- a/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp
+++ b/src/plugins/remotelinux/remotelinuxpackageinstaller.cpp
@@ -76,7 +76,7 @@ void AbstractRemoteLinuxPackageInstaller::installPackage(const IDevice::ConstPtr
QString cmdLine = installCommandLine(packageFilePath);
if (removePackageFile)
cmdLine += QLatin1String(" && (rm ") + packageFilePath + QLatin1String(" || :)");
- d->installer->run(cmdLine.toUtf8(), deviceConfig->sshParameters());
+ d->installer->run(cmdLine, deviceConfig->sshParameters());
d->isRunning = true;
}
@@ -86,7 +86,7 @@ void AbstractRemoteLinuxPackageInstaller::cancelInstallation()
if (!d->killProcess)
d->killProcess = new SshRemoteProcessRunner(this);
- d->killProcess->run(cancelInstallationCommandLine().toUtf8(), d->deviceConfig->sshParameters());
+ d->killProcess->run(cancelInstallationCommandLine(), d->deviceConfig->sshParameters());
setFinished();
}
diff --git a/src/plugins/remotelinux/remotelinuxsignaloperation.cpp b/src/plugins/remotelinux/remotelinuxsignaloperation.cpp
index 64e1f5b2d3..5a5def6bb3 100644
--- a/src/plugins/remotelinux/remotelinuxsignaloperation.cpp
+++ b/src/plugins/remotelinux/remotelinuxsignaloperation.cpp
@@ -60,7 +60,7 @@ void RemoteLinuxSignalOperation::run(const QString &command)
this, &RemoteLinuxSignalOperation::runnerProcessFinished);
connect(m_runner, &QSsh::SshRemoteProcessRunner::connectionError,
this, &RemoteLinuxSignalOperation::runnerConnectionError);
- m_runner->run(command.toLatin1(), m_sshParameters);
+ m_runner->run(command, m_sshParameters);
}
void RemoteLinuxSignalOperation::finish()
diff --git a/src/plugins/remotelinux/rsyncdeploystep.cpp b/src/plugins/remotelinux/rsyncdeploystep.cpp
index 8c0900d750..644ad1c3d6 100644
--- a/src/plugins/remotelinux/rsyncdeploystep.cpp
+++ b/src/plugins/remotelinux/rsyncdeploystep.cpp
@@ -101,7 +101,7 @@ void RsyncDeployService::createRemoteDirectories()
remoteDirs.sort();
remoteDirs.removeDuplicates();
m_mkdir = connection()->createRemoteProcess("mkdir -p " + QtcProcess::Arguments
- ::createUnixArgs(remoteDirs).toString().toUtf8());
+ ::createUnixArgs(remoteDirs).toString());
connect(m_mkdir.get(), &SshRemoteProcess::done, this, [this](const QString &error) {
QString userError;
if (!error.isEmpty())
diff --git a/src/plugins/remotelinux/sshkeydeployer.cpp b/src/plugins/remotelinux/sshkeydeployer.cpp
index 7581a72018..2c73ffeff1 100644
--- a/src/plugins/remotelinux/sshkeydeployer.cpp
+++ b/src/plugins/remotelinux/sshkeydeployer.cpp
@@ -67,9 +67,10 @@ void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams,
this, &SshKeyDeployer::handleConnectionFailure);
connect(&d->deployProcess, &SshRemoteProcessRunner::processClosed,
this, &SshKeyDeployer::handleKeyUploadFinished);
- const QByteArray command = "test -d .ssh "
+ const QString command = "test -d .ssh "
"|| mkdir .ssh && chmod 0700 .ssh && echo '"
- + reader.data() + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys";
+ + QString::fromLocal8Bit(reader.data())
+ + "' >> .ssh/authorized_keys && chmod 0600 .ssh/authorized_keys";
d->deployProcess.run(command, sshParams);
}