2022-01-21 15:01:01 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** 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
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-02-18 00:56:14 +01:00
|
|
|
#include "processenums.h"
|
2022-03-31 15:50:28 +02:00
|
|
|
#include "processinterface.h"
|
|
|
|
|
#include "qtcassert.h"
|
2022-02-18 00:56:14 +01:00
|
|
|
|
|
|
|
|
#include <QProcess>
|
2022-01-21 15:01:01 +01:00
|
|
|
|
|
|
|
|
namespace Utils {
|
|
|
|
|
|
|
|
|
|
class CommandLine;
|
|
|
|
|
class Environment;
|
|
|
|
|
class FilePath;
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2022-04-08 17:24:59 +02:00
|
|
|
class TerminalImpl final : public ProcessInterface
|
2022-01-21 15:01:01 +01:00
|
|
|
{
|
|
|
|
|
public:
|
2022-03-31 15:50:28 +02:00
|
|
|
TerminalImpl();
|
|
|
|
|
~TerminalImpl() final;
|
2022-01-21 15:01:01 +01:00
|
|
|
|
2022-03-31 15:50:28 +02:00
|
|
|
QByteArray readAllStandardOutput() final { QTC_CHECK(false); return {}; }
|
|
|
|
|
QByteArray readAllStandardError() final { QTC_CHECK(false); return {}; }
|
2022-01-21 15:01:01 +01:00
|
|
|
|
2022-03-31 15:50:28 +02:00
|
|
|
qint64 write(const QByteArray &) final { QTC_CHECK(false); return -1; }
|
2022-01-21 15:01:01 +01:00
|
|
|
|
2022-03-31 15:50:28 +02:00
|
|
|
void terminate() final { stopProcess(); }
|
|
|
|
|
void kill() final { stopProcess(); }
|
|
|
|
|
void close() final { stopProcess(); }
|
2022-01-21 15:01:01 +01:00
|
|
|
|
2022-03-31 15:50:28 +02:00
|
|
|
// intentionally no-op without an assert
|
|
|
|
|
bool waitForStarted(int) final { return false; }
|
|
|
|
|
bool waitForReadyRead(int) final { QTC_CHECK(false); return false; }
|
|
|
|
|
// intentionally no-op without an assert
|
|
|
|
|
bool waitForFinished(int) final { return false; }
|
|
|
|
|
|
|
|
|
|
void start() final;
|
2022-01-21 15:01:01 +01:00
|
|
|
|
2022-03-31 15:50:28 +02:00
|
|
|
QProcess::ProcessState state() const final;
|
|
|
|
|
qint64 processId() const final;
|
2022-04-08 17:24:59 +02:00
|
|
|
ProcessResultData resultData() const final;
|
2022-01-21 15:01:01 +01:00
|
|
|
|
2022-03-31 15:50:28 +02:00
|
|
|
void kickoffProcess() final; // only debugger terminal, only non-windows
|
|
|
|
|
void interrupt() final; // only debugger terminal, only non-windows
|
|
|
|
|
qint64 applicationMainThreadID() const final; // only debugger terminal, only windows (-1 otherwise)
|
2022-01-21 15:01:01 +01:00
|
|
|
|
|
|
|
|
private:
|
2022-03-31 15:50:28 +02:00
|
|
|
// OK, however, impl looks a bit different (!= NotRunning vs == Running).
|
|
|
|
|
// Most probably changing it into (== Running) should be OK.
|
|
|
|
|
bool isRunning() const;
|
|
|
|
|
|
|
|
|
|
void stopProcess();
|
2022-01-21 15:01:01 +01:00
|
|
|
void stubConnectionAvailable();
|
|
|
|
|
void readStubOutput();
|
|
|
|
|
void stubExited();
|
|
|
|
|
void cleanupAfterStartFailure(const QString &errorMessage);
|
|
|
|
|
void finish(int exitCode, QProcess::ExitStatus exitStatus);
|
|
|
|
|
void killProcess();
|
|
|
|
|
void killStub();
|
|
|
|
|
void emitError(QProcess::ProcessError err, const QString &errorString);
|
|
|
|
|
QString stubServerListen();
|
|
|
|
|
void stubServerShutdown();
|
|
|
|
|
void cleanupStub();
|
|
|
|
|
void cleanupInferior();
|
|
|
|
|
|
|
|
|
|
class TerminalProcessPrivate *d;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // Utils
|