aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/remotelinux/linuxdevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/remotelinux/linuxdevice.cpp')
-rw-r--r--src/plugins/remotelinux/linuxdevice.cpp61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp
index e6b22eb4bb..6e05739c01 100644
--- a/src/plugins/remotelinux/linuxdevice.cpp
+++ b/src/plugins/remotelinux/linuxdevice.cpp
@@ -196,9 +196,38 @@ LinuxDevice::LinuxDevice()
}
}});
+ setOpenTerminal([this](const Utils::Environment &env, const QString &workingDir) {
+ DeviceProcess * const proc = createProcess(nullptr);
+ QObject::connect(proc, &DeviceProcess::finished, [proc] {
+ if (!proc->errorString().isEmpty()) {
+ Core::MessageManager::write(tr("Error running remote shell: %1")
+ .arg(proc->errorString()),
+ Core::MessageManager::ModeSwitch);
+ }
+ proc->deleteLater();
+ });
+ QObject::connect(proc, &DeviceProcess::error, [proc] {
+ Core::MessageManager::write(tr("Error starting remote shell."),
+ Core::MessageManager::ModeSwitch);
+ proc->deleteLater();
+ });
+ Runnable runnable;
+ runnable.device = sharedFromThis();
+ runnable.environment = env;
+ runnable.workingDirectory = workingDir;
+
+ // It seems we cannot pass an environment to OpenSSH dynamically
+ // without specifying an executable.
+ if (env.size() > 0)
+ runnable.executable = "/bin/sh";
+
+ proc->setRunInTerminal(true);
+ proc->start(runnable);
+ });
+
if (Utils::HostOsInfo::isAnyUnixHost()) {
addDeviceAction({tr("Open Remote Shell"), [](const IDevice::Ptr &device, QWidget *) {
- device.staticCast<LinuxDevice>()->startRemoteShell(Utils::Environment());
+ device->openTerminal(Utils::Environment(), QString());
}});
}
}
@@ -268,36 +297,6 @@ bool LinuxDevice::supportsRSync() const
return extraData("RemoteLinux.SupportsRSync").toBool();
}
-void LinuxDevice::startRemoteShell(const Utils::Environment &env) const
-{
- DeviceProcess * const proc = createProcess(nullptr);
- QObject::connect(proc, &DeviceProcess::finished, [proc] {
- if (!proc->errorString().isEmpty()) {
- Core::MessageManager::write(tr("Error running remote shell: %1")
- .arg(proc->errorString()),
- Core::MessageManager::ModeSwitch);
- }
- proc->deleteLater();
- });
- QObject::connect(proc, &DeviceProcess::error, [proc] {
- Core::MessageManager::write(tr("Error starting remote shell."),
- Core::MessageManager::ModeSwitch);
- proc->deleteLater();
- });
- Runnable runnable;
- runnable.device = sharedFromThis();
- runnable.environment = env;
-
- // It seems we cannot pass an environment to OpenSSH dynamically
- // without specifying an executable.
- if (env.size() > 0)
- runnable.executable = "/bin/sh";
-
- proc->setRunInTerminal(true);
- proc->start(runnable);
-}
-
-
namespace Internal {
// Factory