2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2022-02-14 18:37:56 +01:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "remotelinux_export.h"
|
|
|
|
|
|
2023-03-16 10:30:46 +01:00
|
|
|
#include <projectexplorer/devicesupport/idevice.h>
|
|
|
|
|
|
2022-02-14 18:37:56 +01:00
|
|
|
#include <utils/processinterface.h>
|
|
|
|
|
|
|
|
|
|
namespace RemoteLinux {
|
|
|
|
|
|
|
|
|
|
class LinuxDevice;
|
|
|
|
|
class SshProcessInterfacePrivate;
|
|
|
|
|
|
|
|
|
|
class REMOTELINUX_EXPORT SshProcessInterface : public Utils::ProcessInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
SshProcessInterface(const LinuxDevice *linuxDevice);
|
|
|
|
|
~SshProcessInterface();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void emitStarted(qint64 processId);
|
|
|
|
|
// To be called from leaf destructor.
|
|
|
|
|
// Can't call it from SshProcessInterface destructor as it calls virtual method.
|
|
|
|
|
void killIfRunning();
|
2022-04-29 13:18:42 +02:00
|
|
|
qint64 processId() const;
|
|
|
|
|
bool runInShell(const Utils::CommandLine &command, const QByteArray &data = {});
|
2022-02-14 18:37:56 +01:00
|
|
|
|
2023-03-16 10:30:46 +01:00
|
|
|
ProjectExplorer::IDevice::ConstPtr device() const;
|
|
|
|
|
|
2022-02-14 18:37:56 +01:00
|
|
|
private:
|
|
|
|
|
virtual void handleStarted(qint64 processId);
|
2022-05-25 20:08:12 +02:00
|
|
|
virtual void handleDone(const Utils::ProcessResultData &resultData);
|
2022-02-14 18:37:56 +01:00
|
|
|
virtual void handleReadyReadStandardOutput(const QByteArray &outputData);
|
2022-05-04 13:09:22 +02:00
|
|
|
virtual void handleReadyReadStandardError(const QByteArray &errorData);
|
2022-11-14 15:23:01 +01:00
|
|
|
virtual void handleSendControlSignal(Utils::ControlSignal controlSignal) = 0;
|
2022-02-14 18:37:56 +01:00
|
|
|
|
|
|
|
|
virtual QString fullCommandLine(const Utils::CommandLine &commandLine) const = 0;
|
|
|
|
|
|
|
|
|
|
void start() final;
|
|
|
|
|
qint64 write(const QByteArray &data) final;
|
2022-11-14 15:23:01 +01:00
|
|
|
void sendControlSignal(Utils::ControlSignal controlSignal) final;
|
2022-02-14 18:37:56 +01:00
|
|
|
|
|
|
|
|
friend class SshProcessInterfacePrivate;
|
|
|
|
|
SshProcessInterfacePrivate *d = nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace RemoteLinux
|