2013-08-08 14:05:11 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-08-08 14:05:11 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2013-08-08 14:05:11 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2013-08-08 14:05:11 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "sshdeviceprocess.h"
|
|
|
|
|
|
|
|
|
|
#include "idevice.h"
|
2019-03-13 08:06:08 +01:00
|
|
|
#include "../runcontrol.h"
|
2013-08-08 14:05:11 +02:00
|
|
|
|
2020-01-15 12:44:58 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2013-08-08 14:05:11 +02:00
|
|
|
#include <ssh/sshconnection.h>
|
|
|
|
|
#include <ssh/sshconnectionmanager.h>
|
|
|
|
|
#include <ssh/sshremoteprocess.h>
|
|
|
|
|
#include <utils/environment.h>
|
|
|
|
|
#include <utils/qtcassert.h>
|
2022-01-24 18:09:36 +01:00
|
|
|
#include <utils/qtcprocess.h>
|
2013-08-08 14:05:11 +02:00
|
|
|
|
|
|
|
|
#include <QString>
|
2013-10-16 12:03:46 +02:00
|
|
|
#include <QTimer>
|
2013-08-08 14:05:11 +02:00
|
|
|
|
2019-01-10 09:21:26 +01:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2013-08-08 14:05:11 +02:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
|
2018-11-23 11:07:57 +01:00
|
|
|
enum class Signal { Interrupt, Terminate, Kill };
|
|
|
|
|
|
2013-08-08 14:05:11 +02:00
|
|
|
class SshDeviceProcess::SshDeviceProcessPrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
2022-01-27 11:30:25 +01:00
|
|
|
SshDeviceProcessPrivate(SshDeviceProcess *q) : q(q) {}
|
2013-08-08 14:05:11 +02:00
|
|
|
|
|
|
|
|
SshDeviceProcess * const q;
|
2022-02-08 11:35:35 +01:00
|
|
|
bool ignoreSelfSignals = true;
|
2017-08-25 15:50:42 +03:00
|
|
|
QSsh::SshConnection *connection = nullptr;
|
2022-01-27 11:30:25 +01:00
|
|
|
QSsh::SshRemoteProcessPtr remoteProcess;
|
2018-05-16 15:42:03 +02:00
|
|
|
Runnable runnable;
|
2013-08-08 14:05:11 +02:00
|
|
|
QString errorMessage;
|
2018-11-23 11:07:57 +01:00
|
|
|
QProcess::ExitStatus exitStatus = QProcess::NormalExit;
|
2013-10-16 12:03:46 +02:00
|
|
|
DeviceProcessSignalOperation::Ptr killOperation;
|
|
|
|
|
QTimer killTimer;
|
2017-08-25 15:50:42 +03:00
|
|
|
enum State { Inactive, Connecting, Connected, ProcessRunning } state = Inactive;
|
2013-08-08 14:05:11 +02:00
|
|
|
|
|
|
|
|
void setState(State newState);
|
2018-11-23 11:07:57 +01:00
|
|
|
void doSignal(Signal signal);
|
2018-11-01 12:24:03 +01:00
|
|
|
|
|
|
|
|
QString displayName() const
|
|
|
|
|
{
|
|
|
|
|
return runnable.extraData.value("Ssh.X11ForwardToDisplay").toString();
|
|
|
|
|
}
|
2013-08-08 14:05:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
SshDeviceProcess::SshDeviceProcess(const IDevice::ConstPtr &device, QObject *parent)
|
2022-02-10 19:25:03 +01:00
|
|
|
: DeviceProcess(device, parent),
|
2022-01-27 11:30:25 +01:00
|
|
|
d(std::make_unique<SshDeviceProcessPrivate>(this))
|
2013-08-08 14:05:11 +02:00
|
|
|
{
|
2022-02-10 19:25:03 +01:00
|
|
|
setTerminalMode(QtcProcess::TerminalOn);
|
|
|
|
|
|
2022-02-08 11:35:35 +01:00
|
|
|
// Hack: we rely on fact that below slots were called before any other external slots connected
|
|
|
|
|
// to this instance signals. That's why we don't re-emit them from inside our handlers since
|
|
|
|
|
// these signal will reach all other external slots anyway after our handlers are done.
|
|
|
|
|
connect(this, &QtcProcess::started, this, [this] {
|
|
|
|
|
if (!d->ignoreSelfSignals)
|
|
|
|
|
handleProcessStarted();
|
|
|
|
|
});
|
|
|
|
|
connect(this, &QtcProcess::finished, this, [this] {
|
|
|
|
|
if (!d->ignoreSelfSignals)
|
|
|
|
|
handleProcessFinished(QtcProcess::errorString());
|
|
|
|
|
});
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(&d->killTimer, &QTimer::timeout, this, &SshDeviceProcess::handleKillOperationTimeout);
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SshDeviceProcess::~SshDeviceProcess()
|
|
|
|
|
{
|
|
|
|
|
d->setState(SshDeviceProcessPrivate::Inactive);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-27 18:25:13 +01:00
|
|
|
void SshDeviceProcess::start(const Runnable &runnable)
|
2013-08-08 14:05:11 +02:00
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::Inactive, return);
|
2022-02-10 19:25:03 +01:00
|
|
|
QTC_ASSERT(usesTerminal() || !runnable.command.isEmpty(), return);
|
2013-08-08 14:05:11 +02:00
|
|
|
d->setState(SshDeviceProcessPrivate::Connecting);
|
|
|
|
|
|
|
|
|
|
d->errorMessage.clear();
|
2018-11-23 11:07:57 +01:00
|
|
|
d->exitStatus = QProcess::NormalExit;
|
2018-05-16 15:42:03 +02:00
|
|
|
d->runnable = runnable;
|
2018-11-23 11:07:57 +01:00
|
|
|
QSsh::SshConnectionParameters params = device()->sshParameters();
|
|
|
|
|
params.x11DisplayName = d->displayName();
|
2021-09-09 15:29:28 +02:00
|
|
|
d->connection = QSsh::SshConnectionManager::acquireConnection(params);
|
2018-11-23 11:07:57 +01:00
|
|
|
connect(d->connection, &QSsh::SshConnection::errorOccurred,
|
2016-01-29 16:38:37 +02:00
|
|
|
this, &SshDeviceProcess::handleConnectionError);
|
|
|
|
|
connect(d->connection, &QSsh::SshConnection::disconnected,
|
|
|
|
|
this, &SshDeviceProcess::handleDisconnected);
|
2013-08-08 14:05:11 +02:00
|
|
|
if (d->connection->state() == QSsh::SshConnection::Connected) {
|
|
|
|
|
handleConnected();
|
|
|
|
|
} else {
|
2016-01-29 16:38:37 +02:00
|
|
|
connect(d->connection, &QSsh::SshConnection::connected,
|
|
|
|
|
this, &SshDeviceProcess::handleConnected);
|
2013-08-08 14:05:11 +02:00
|
|
|
if (d->connection->state() == QSsh::SshConnection::Unconnected)
|
|
|
|
|
d->connection->connectToHost();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::interrupt()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::ProcessRunning, return);
|
2018-11-23 11:07:57 +01:00
|
|
|
d->doSignal(Signal::Interrupt);
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::terminate()
|
|
|
|
|
{
|
2022-01-14 16:01:34 +01:00
|
|
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::ProcessRunning, return);
|
2018-11-23 11:07:57 +01:00
|
|
|
d->doSignal(Signal::Terminate);
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::kill()
|
|
|
|
|
{
|
2022-01-14 16:01:34 +01:00
|
|
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::ProcessRunning, return);
|
2018-11-23 11:07:57 +01:00
|
|
|
d->doSignal(Signal::Kill);
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QProcess::ProcessState SshDeviceProcess::state() const
|
|
|
|
|
{
|
|
|
|
|
switch (d->state) {
|
|
|
|
|
case SshDeviceProcessPrivate::Inactive:
|
|
|
|
|
return QProcess::NotRunning;
|
|
|
|
|
case SshDeviceProcessPrivate::Connecting:
|
|
|
|
|
case SshDeviceProcessPrivate::Connected:
|
|
|
|
|
return QProcess::Starting;
|
|
|
|
|
case SshDeviceProcessPrivate::ProcessRunning:
|
|
|
|
|
return QProcess::Running;
|
|
|
|
|
default:
|
|
|
|
|
QTC_CHECK(false);
|
|
|
|
|
return QProcess::NotRunning;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QProcess::ExitStatus SshDeviceProcess::exitStatus() const
|
|
|
|
|
{
|
2022-01-28 14:08:35 +01:00
|
|
|
return d->exitStatus == QProcess::NormalExit && exitCode() != 255
|
2013-08-08 14:05:11 +02:00
|
|
|
? QProcess::NormalExit : QProcess::CrashExit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SshDeviceProcess::exitCode() const
|
|
|
|
|
{
|
2022-02-10 19:25:03 +01:00
|
|
|
return usesTerminal() ? QtcProcess::exitCode() : d->remoteProcess->exitCode();
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString SshDeviceProcess::errorString() const
|
|
|
|
|
{
|
|
|
|
|
return d->errorMessage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QByteArray SshDeviceProcess::readAllStandardOutput()
|
|
|
|
|
{
|
2022-01-28 13:55:58 +01:00
|
|
|
return d->remoteProcess.get() ? d->remoteProcess->readAllStandardOutput() : QByteArray();
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QByteArray SshDeviceProcess::readAllStandardError()
|
|
|
|
|
{
|
2022-01-28 13:55:58 +01:00
|
|
|
return d->remoteProcess.get() ? d->remoteProcess->readAllStandardError() : QByteArray();
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
2016-04-21 11:49:10 +02:00
|
|
|
qint64 SshDeviceProcess::processId() const
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-08 14:05:11 +02:00
|
|
|
void SshDeviceProcess::handleConnected()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::Connecting, return);
|
|
|
|
|
d->setState(SshDeviceProcessPrivate::Connected);
|
|
|
|
|
|
2022-02-10 19:25:03 +01:00
|
|
|
d->remoteProcess = usesTerminal() && d->runnable.command.isEmpty()
|
2019-01-10 12:58:04 +01:00
|
|
|
? d->connection->createRemoteShell()
|
2019-05-21 16:59:29 +02:00
|
|
|
: d->connection->createRemoteProcess(fullCommandLine(d->runnable));
|
2018-11-01 12:24:03 +01:00
|
|
|
const QString display = d->displayName();
|
|
|
|
|
if (!display.isEmpty())
|
2022-01-27 11:30:25 +01:00
|
|
|
d->remoteProcess->requestX11Forwarding(display);
|
2022-02-10 19:25:03 +01:00
|
|
|
d->ignoreSelfSignals = !usesTerminal();
|
|
|
|
|
if (usesTerminal()) {
|
2022-01-27 19:09:06 +01:00
|
|
|
setAbortOnMetaChars(false);
|
|
|
|
|
setCommand(d->remoteProcess->fullLocalCommandLine(true));
|
|
|
|
|
QtcProcess::start();
|
2019-01-10 09:21:26 +01:00
|
|
|
} else {
|
2022-01-27 11:30:25 +01:00
|
|
|
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::started,
|
2019-01-10 09:21:26 +01:00
|
|
|
this, &SshDeviceProcess::handleProcessStarted);
|
2022-01-27 11:30:25 +01:00
|
|
|
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::done,
|
2022-02-08 11:35:35 +01:00
|
|
|
this, &SshDeviceProcess::handleProcessFinished);
|
2022-01-27 11:30:25 +01:00
|
|
|
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::readyReadStandardOutput,
|
2022-01-28 13:55:58 +01:00
|
|
|
this, &QtcProcess::readyReadStandardOutput);
|
2022-01-27 11:30:25 +01:00
|
|
|
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::readyReadStandardError,
|
2022-01-28 13:55:58 +01:00
|
|
|
this, &QtcProcess::readyReadStandardError);
|
2022-01-27 11:30:25 +01:00
|
|
|
d->remoteProcess->start();
|
2019-01-10 09:21:26 +01:00
|
|
|
}
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::handleConnectionError()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->state != SshDeviceProcessPrivate::Inactive, return);
|
|
|
|
|
|
|
|
|
|
d->errorMessage = d->connection->errorString();
|
|
|
|
|
handleDisconnected();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::handleDisconnected()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->state != SshDeviceProcessPrivate::Inactive, return);
|
|
|
|
|
const SshDeviceProcessPrivate::State oldState = d->state;
|
|
|
|
|
d->setState(SshDeviceProcessPrivate::Inactive);
|
|
|
|
|
switch (oldState) {
|
|
|
|
|
case SshDeviceProcessPrivate::Connecting:
|
|
|
|
|
case SshDeviceProcessPrivate::Connected:
|
2022-01-27 10:55:39 +01:00
|
|
|
emit errorOccurred(QProcess::FailedToStart);
|
2013-08-08 14:05:11 +02:00
|
|
|
break;
|
|
|
|
|
case SshDeviceProcessPrivate::ProcessRunning:
|
2021-06-25 14:54:27 +02:00
|
|
|
d->exitStatus = QProcess::CrashExit;
|
2013-08-08 14:05:11 +02:00
|
|
|
emit finished();
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::handleProcessStarted()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::Connected, return);
|
|
|
|
|
|
|
|
|
|
d->setState(SshDeviceProcessPrivate::ProcessRunning);
|
2022-02-08 11:35:35 +01:00
|
|
|
if (d->ignoreSelfSignals)
|
|
|
|
|
emit started();
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
2022-02-08 11:35:35 +01:00
|
|
|
void SshDeviceProcess::handleProcessFinished(const QString &error)
|
2013-08-08 14:05:11 +02:00
|
|
|
{
|
2018-12-14 10:12:59 +01:00
|
|
|
d->errorMessage = error;
|
2022-01-14 16:01:34 +01:00
|
|
|
if (d->killOperation && error.isEmpty())
|
|
|
|
|
d->errorMessage = tr("The process was ended forcefully.");
|
2013-08-08 14:05:11 +02:00
|
|
|
d->setState(SshDeviceProcessPrivate::Inactive);
|
2022-02-08 11:35:35 +01:00
|
|
|
if (d->ignoreSelfSignals)
|
2022-01-31 14:53:41 +01:00
|
|
|
emit finished();
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-16 12:03:46 +02:00
|
|
|
void SshDeviceProcess::handleKillOperationFinished(const QString &errorMessage)
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(d->state == SshDeviceProcessPrivate::ProcessRunning, return);
|
|
|
|
|
if (errorMessage.isEmpty()) // Process will finish as expected; nothing to do here.
|
|
|
|
|
return;
|
|
|
|
|
|
2021-06-25 14:54:27 +02:00
|
|
|
d->exitStatus = QProcess::CrashExit; // Not entirely true, but it will get the message across.
|
2013-10-16 12:03:46 +02:00
|
|
|
d->errorMessage = tr("Failed to kill remote process: %1").arg(errorMessage);
|
|
|
|
|
d->setState(SshDeviceProcessPrivate::Inactive);
|
|
|
|
|
emit finished();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::handleKillOperationTimeout()
|
|
|
|
|
{
|
2021-06-25 14:54:27 +02:00
|
|
|
d->exitStatus = QProcess::CrashExit; // Not entirely true, but it will get the message across.
|
2013-10-16 12:03:46 +02:00
|
|
|
d->errorMessage = tr("Timeout waiting for remote process to finish.");
|
|
|
|
|
d->setState(SshDeviceProcessPrivate::Inactive);
|
|
|
|
|
emit finished();
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-16 13:49:32 +02:00
|
|
|
QString SshDeviceProcess::fullCommandLine(const Runnable &runnable) const
|
2013-08-08 14:05:11 +02:00
|
|
|
{
|
2021-08-10 09:19:30 +02:00
|
|
|
QString cmdLine = runnable.command.executable().toString();
|
|
|
|
|
// FIXME: That quotes wrongly.
|
|
|
|
|
if (!runnable.command.arguments().isEmpty())
|
|
|
|
|
cmdLine.append(QLatin1Char(' ')).append(runnable.command.arguments());
|
2013-08-08 14:05:11 +02:00
|
|
|
return cmdLine;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-23 11:07:57 +01:00
|
|
|
void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal)
|
2013-08-08 14:05:11 +02:00
|
|
|
{
|
2021-08-10 09:19:30 +02:00
|
|
|
if (runnable.command.isEmpty())
|
2019-01-10 12:58:04 +01:00
|
|
|
return;
|
2013-08-08 14:05:11 +02:00
|
|
|
switch (state) {
|
|
|
|
|
case SshDeviceProcessPrivate::Inactive:
|
|
|
|
|
QTC_ASSERT(false, return);
|
|
|
|
|
break;
|
|
|
|
|
case SshDeviceProcessPrivate::Connecting:
|
|
|
|
|
errorMessage = tr("Terminated by request.");
|
|
|
|
|
setState(SshDeviceProcessPrivate::Inactive);
|
2022-01-27 10:55:39 +01:00
|
|
|
emit q->errorOccurred(QProcess::FailedToStart);
|
2013-08-08 14:05:11 +02:00
|
|
|
break;
|
|
|
|
|
case SshDeviceProcessPrivate::Connected:
|
|
|
|
|
case SshDeviceProcessPrivate::ProcessRunning:
|
2018-11-23 11:07:57 +01:00
|
|
|
DeviceProcessSignalOperation::Ptr signalOperation = q->device()->signalOperation();
|
2019-07-23 13:24:30 +02:00
|
|
|
const qint64 processId = q->processId();
|
2018-11-23 11:07:57 +01:00
|
|
|
if (signal == Signal::Interrupt) {
|
|
|
|
|
if (processId != 0)
|
|
|
|
|
signalOperation->interruptProcess(processId);
|
|
|
|
|
else
|
2021-08-10 09:19:30 +02:00
|
|
|
signalOperation->interruptProcess(runnable.command.executable().toString());
|
2013-08-08 14:05:11 +02:00
|
|
|
} else {
|
2018-11-23 11:07:57 +01:00
|
|
|
if (killOperation) // We are already in the process of killing the app.
|
|
|
|
|
return;
|
|
|
|
|
killOperation = signalOperation;
|
|
|
|
|
connect(signalOperation.data(), &DeviceProcessSignalOperation::finished, q,
|
|
|
|
|
&SshDeviceProcess::handleKillOperationFinished);
|
|
|
|
|
killTimer.start(5000);
|
|
|
|
|
if (processId != 0)
|
|
|
|
|
signalOperation->killProcess(processId);
|
|
|
|
|
else
|
2021-08-10 09:19:30 +02:00
|
|
|
signalOperation->killProcess(runnable.command.executable().toString());
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SshDeviceProcess::SshDeviceProcessPrivate::setState(SshDeviceProcess::SshDeviceProcessPrivate::State newState)
|
|
|
|
|
{
|
|
|
|
|
if (state == newState)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
state = newState;
|
|
|
|
|
if (state != Inactive)
|
|
|
|
|
return;
|
|
|
|
|
|
2013-10-16 12:03:46 +02:00
|
|
|
if (killOperation) {
|
|
|
|
|
killOperation->disconnect(q);
|
|
|
|
|
killOperation.clear();
|
2022-02-10 19:25:03 +01:00
|
|
|
if (q->usesTerminal())
|
2022-01-27 19:09:06 +01:00
|
|
|
QMetaObject::invokeMethod(q, &QtcProcess::stopProcess, Qt::QueuedConnection);
|
2013-10-16 12:03:46 +02:00
|
|
|
}
|
|
|
|
|
killTimer.stop();
|
2022-01-27 11:30:25 +01:00
|
|
|
if (remoteProcess)
|
|
|
|
|
remoteProcess->disconnect(q);
|
2013-08-08 14:05:11 +02:00
|
|
|
if (connection) {
|
|
|
|
|
connection->disconnect(q);
|
2021-09-09 15:29:28 +02:00
|
|
|
QSsh::SshConnectionManager::releaseConnection(connection);
|
2018-07-12 22:17:17 +02:00
|
|
|
connection = nullptr;
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-09 17:32:21 +02:00
|
|
|
qint64 SshDeviceProcess::write(const QByteArray &data)
|
|
|
|
|
{
|
2022-02-10 19:25:03 +01:00
|
|
|
QTC_ASSERT(!usesTerminal(), return -1);
|
2022-01-27 11:30:25 +01:00
|
|
|
return d->remoteProcess->write(data);
|
2013-09-09 17:32:21 +02:00
|
|
|
}
|
|
|
|
|
|
2013-08-08 14:05:11 +02:00
|
|
|
} // namespace ProjectExplorer
|