forked from qt-creator/qt-creator
Ssh: Use Utils::CommandLine in SshRemoteProcess
Change-Id: I074ca3e1e8ec8ce990d6b314a4a87de2f656566c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -83,15 +83,14 @@ SshRemoteProcess::SshRemoteProcess(const QString &command, const QStringList &co
|
||||
void SshRemoteProcess::doStart()
|
||||
{
|
||||
QTC_ASSERT(!isRunning(), return);
|
||||
const QStringList args = fullLocalCommandLine();
|
||||
const Utils::CommandLine cmd = fullLocalCommandLine();
|
||||
if (!d->displayName.isEmpty()) {
|
||||
QProcessEnvironment env = processEnvironment();
|
||||
env.insert("DISPLAY", d->displayName);
|
||||
setProcessEnvironment(env);
|
||||
}
|
||||
qCDebug(sshLog) << "starting remote process:" << QDir::toNativeSeparators(args.first())
|
||||
<< args;
|
||||
QProcess::start(args.first(), args.mid(1));
|
||||
qCDebug(sshLog) << "starting remote process:" << cmd.toUserOutput();
|
||||
QProcess::start(cmd.executable().toString(), cmd.splitArguments());
|
||||
}
|
||||
|
||||
SshRemoteProcess::~SshRemoteProcess()
|
||||
@@ -119,17 +118,22 @@ bool SshRemoteProcess::isRunning() const
|
||||
return state() == QProcess::Running;
|
||||
}
|
||||
|
||||
QStringList SshRemoteProcess::fullLocalCommandLine() const
|
||||
Utils::CommandLine SshRemoteProcess::fullLocalCommandLine() const
|
||||
{
|
||||
QStringList args = QStringList("-q") << d->connectionArgs;
|
||||
if (d->useTerminal)
|
||||
args.prepend("-tt");
|
||||
Utils::CommandLine cmd{SshSettings::sshFilePath()};
|
||||
|
||||
if (!d->displayName.isEmpty())
|
||||
args.prepend("-X");
|
||||
cmd.addArg("-X");
|
||||
if (d->useTerminal)
|
||||
cmd.addArg("-tt");
|
||||
|
||||
cmd.addArg("-q");
|
||||
cmd.addArgs(d->connectionArgs);
|
||||
|
||||
if (!d->remoteCommand.isEmpty())
|
||||
args << d->remoteCommand;
|
||||
args.prepend(SshSettings::sshFilePath().toString());
|
||||
return args;
|
||||
cmd.addArg(d->remoteCommand);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
} // namespace QSsh
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "ssh_global.h"
|
||||
#include "sshprocess.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
namespace QSsh {
|
||||
class SshConnection;
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
void start();
|
||||
|
||||
bool isRunning() const;
|
||||
QStringList fullLocalCommandLine() const;
|
||||
Utils::CommandLine fullLocalCommandLine() const;
|
||||
|
||||
signals:
|
||||
void done(const QString &error);
|
||||
|
||||
Reference in New Issue
Block a user