blob: a1960e7b966ef0f1e92d57749d4c612748a4abe9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
#include "commandline.h"
#include "expected.h"
#include "processinterface.h"
namespace Utils {
class TerminalInterfacePrivate;
class StubCreator : public QObject
{
public:
virtual expected_str<qint64> startStubProcess(const ProcessSetupData &setup) = 0;
};
class QTCREATOR_UTILS_EXPORT TerminalInterface : public ProcessInterface
{
friend class TerminalInterfacePrivate;
friend class StubCreator;
public:
TerminalInterface(bool waitOnExit = true);
~TerminalInterface() override;
int inferiorProcessId() const;
int inferiorThreadId() const;
void setStubCreator(StubCreator *creator);
void emitError(QProcess::ProcessError error, const QString &errorString);
void emitFinished(int exitCode, QProcess::ExitStatus exitStatus);
void onStubExited();
protected:
void onNewStubConnection();
void onStubReadyRead();
void sendCommand(char c);
void killInferiorProcess();
void killStubProcess();
expected_str<void> startStubServer();
void shutdownStubServer();
void cleanupAfterStartFailure(const QString &errorMessage);
bool isRunning() const;
private:
void start() override;
qint64 write(const QByteArray &data) override;
void sendControlSignal(ControlSignal controlSignal) override;
TerminalInterfacePrivate *d{nullptr};
};
} // namespace Utils
|