From 0b2899215fe89e154e9c484d75107f977c766ec2 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Wed, 8 Jun 2022 14:24:40 +0200 Subject: [PATCH] Introduce ProcessBlockingInterface This replaces the ProcessInterface::waitFor...() methods. It's not obligatory to provide this interface when implementing ProcessInterface subclass. In this case generic blocking implementation will be used. The generic implementation usually isn't as efficient as the custom one, however, for some sophisticated implementations of process interface, like e.g. SshProcessInterface, providing custom implementation is really difficult and error prone. That's why we try to keep a balance: we provide two custom implementations for QProcessImpl and for ProcessLauncherImpl, as they are relatively easy to implement, and rely on generic implementation for others. Change-Id: Ifc8bd354479ec67b2e8f74f1510f8de8883e9b94 Reviewed-by: Reviewed-by: hjk --- src/libs/utils/launchersocket.cpp | 21 +- src/libs/utils/launchersocket.h | 8 +- src/libs/utils/processinterface.h | 24 +- src/libs/utils/qtcprocess.cpp | 262 ++++++++++++------ src/libs/utils/terminalprocess_p.h | 6 - src/plugins/docker/dockerdevice.cpp | 25 -- src/plugins/remotelinux/linuxdevice.cpp | 21 -- src/plugins/remotelinux/sshprocessinterface.h | 4 - 8 files changed, 190 insertions(+), 181 deletions(-) diff --git a/src/libs/utils/launchersocket.cpp b/src/libs/utils/launchersocket.cpp index fc8ea36042f..c3d2b8942ab 100644 --- a/src/libs/utils/launchersocket.cpp +++ b/src/libs/utils/launchersocket.cpp @@ -89,21 +89,6 @@ CallerHandle::~CallerHandle() qDeleteAll(m_signals); } -bool CallerHandle::waitForStarted(int msecs) -{ - return waitForSignal(msecs, SignalType::Started); -} - -bool CallerHandle::waitForReadyRead(int msces) -{ - return waitForSignal(msces, SignalType::ReadyRead); -} - -bool CallerHandle::waitForFinished(int msecs) -{ - return waitForSignal(msecs, SignalType::Done); -} - void CallerHandle::flush() { flushFor(SignalType::NoSignal); @@ -329,11 +314,11 @@ void CallerHandle::setProcessSetupData(ProcessSetupData *setup) m_setup = setup; } -bool CallerHandle::waitForSignal(int msecs, SignalType newSignal) +bool CallerHandle::waitForSignal(SignalType signalType, int msecs) { QTC_ASSERT(isCalledFromCallersThread(), return false); QTC_ASSERT(m_launcherHandle, return false); - return m_launcherHandle->waitForSignal(msecs, newSignal); + return m_launcherHandle->waitForSignal(signalType, msecs); } // Called from caller's or launcher's thread. @@ -351,7 +336,7 @@ bool CallerHandle::isCalledFromLaunchersThread() const } // Called from caller's thread exclusively. -bool LauncherHandle::waitForSignal(int msecs, CallerHandle::SignalType newSignal) +bool LauncherHandle::waitForSignal(CallerHandle::SignalType newSignal, int msecs) { QTC_ASSERT(!isCalledFromLaunchersThread(), return false); QDeadlineTimer deadline(msecs); diff --git a/src/libs/utils/launchersocket.h b/src/libs/utils/launchersocket.h index 081cd314659..4956bf652bf 100644 --- a/src/libs/utils/launchersocket.h +++ b/src/libs/utils/launchersocket.h @@ -73,9 +73,7 @@ public: LauncherHandle *launcherHandle() const { return m_launcherHandle; } void setLauncherHandle(LauncherHandle *handle) { QMutexLocker locker(&m_mutex); m_launcherHandle = handle; } - bool waitForStarted(int msecs); - bool waitForReadyRead(int msces); - bool waitForFinished(int msecs); + bool waitForSignal(CallerHandle::SignalType signalType, int msecs); // Returns the list of flushed signals. void flush(); @@ -109,8 +107,6 @@ signals: void done(const Utils::ProcessResultData &resultData); private: - bool waitForSignal(int msecs, SignalType newSignal); - // Called from caller's thread exclusively. void sendPacket(const Internal::LauncherPacket &packet); // Called from caller's or launcher's thread. @@ -158,7 +154,7 @@ public: // Called from caller's thread, moved to launcher's thread afterwards. LauncherHandle(quintptr token) : m_token(token) {} // Called from caller's thread exclusively. - bool waitForSignal(int msecs, CallerHandle::SignalType newSignal); + bool waitForSignal(CallerHandle::SignalType newSignal, int msecs); CallerHandle *callerHandle() const { return m_callerHandle; } void setCallerHandle(CallerHandle *handle) { QMutexLocker locker(&m_mutex); m_callerHandle = handle; } diff --git a/src/libs/utils/processinterface.h b/src/libs/utils/processinterface.h index 727d3caf946..0ca1cc1f15d 100644 --- a/src/libs/utils/processinterface.h +++ b/src/libs/utils/processinterface.h @@ -85,13 +85,22 @@ enum class ProcessSignalType { Done }; +class QTCREATOR_UTILS_EXPORT ProcessBlockingInterface : public QObject +{ +private: + // Wait for: + // - Started is being called only in Starting state. + // - ReadyRead is being called in Starting or Running state. + // - Done is being called in Starting or Running state. + virtual bool waitForSignal(ProcessSignalType signalType, int msecs) = 0; + + friend class Internal::QtcProcessPrivate; +}; + class QTCREATOR_UTILS_EXPORT ProcessInterface : public QObject { Q_OBJECT -public: - ProcessInterface(QObject *parent = nullptr) : QObject(parent) {} - signals: // This should be emitted when being in Starting state only. // After emitting this signal the process enters Running state. @@ -121,14 +130,7 @@ private: // It's being called in Starting or Running state. virtual void sendControlSignal(ControlSignal controlSignal) = 0; - // It's being called only in Starting state. - virtual bool waitForStarted(int msecs) = 0; - - // It's being called in Starting or Running state. - virtual bool waitForReadyRead(int msecs) = 0; - - // It's being called in Starting or Running state. - virtual bool waitForFinished(int msecs) = 0; + virtual ProcessBlockingInterface *processBlockingInterface() const { return nullptr; } friend class QtcProcess; friend class Internal::QtcProcessPrivate; diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index b309106f6be..6aeb7cac897 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -322,10 +322,34 @@ bool DefaultImpl::ensureProgramExists(const QString &program) return false; } +class QProcessBlockingImpl : public ProcessBlockingInterface +{ +public: + QProcessBlockingImpl(QProcess *process) : m_process(process) {} + +private: + bool waitForSignal(ProcessSignalType signalType, int msecs) final + { + switch (signalType) { + case ProcessSignalType::Started: + return m_process->waitForStarted(msecs); + case ProcessSignalType::ReadyRead: + return m_process->waitForReadyRead(msecs); + case ProcessSignalType::Done: + return m_process->waitForFinished(msecs); + } + return false; + } + + QProcess *m_process = nullptr; +}; + class QProcessImpl final : public DefaultImpl { public: - QProcessImpl() : m_process(new ProcessHelper(this)) + QProcessImpl() + : m_process(new ProcessHelper(this)) + , m_blockingImpl(new QProcessBlockingImpl(m_process)) { connect(m_process, &QProcess::started, this, &QProcessImpl::handleStarted); @@ -361,9 +385,7 @@ private: } } - bool waitForStarted(int msecs) final { return m_process->waitForStarted(msecs); } - bool waitForReadyRead(int msecs) final { return m_process->waitForReadyRead(msecs); } - bool waitForFinished(int msecs) final { return m_process->waitForFinished(msecs); } + virtual ProcessBlockingInterface *processBlockingInterface() const { return m_blockingImpl; } void doDefaultStart(const QString &program, const QStringList &arguments) final { @@ -411,7 +433,8 @@ private: emit done(result); } - ProcessHelper *m_process; + ProcessHelper *m_process = nullptr; + QProcessBlockingImpl *m_blockingImpl = nullptr; }; static uint uniqueToken() @@ -420,6 +443,33 @@ static uint uniqueToken() return ++globalUniqueToken; } +class ProcessLauncherBlockingImpl : public ProcessBlockingInterface +{ +public: + ProcessLauncherBlockingImpl(CallerHandle *caller) : m_caller(caller) {} + +private: + bool waitForSignal(ProcessSignalType signalType, int msecs) final + { + // TODO: Remove CallerHandle::SignalType + const CallerHandle::SignalType type = [signalType] { + switch (signalType) { + case ProcessSignalType::Started: + return CallerHandle::SignalType::Started; + case ProcessSignalType::ReadyRead: + return CallerHandle::SignalType::ReadyRead; + case ProcessSignalType::Done: + return CallerHandle::SignalType::Done; + } + QTC_CHECK(false); + return CallerHandle::SignalType::NoSignal; + }(); + return m_caller->waitForSignal(type, msecs); + } + + CallerHandle *m_caller = nullptr; +}; + class ProcessLauncherImpl final : public DefaultImpl { Q_OBJECT @@ -434,6 +484,7 @@ public: this, &ProcessInterface::readyRead); connect(m_handle, &CallerHandle::done, this, &ProcessInterface::done); + m_blockingImpl = new ProcessLauncherBlockingImpl(m_handle); } ~ProcessLauncherImpl() final { @@ -462,9 +513,7 @@ private: } } - bool waitForStarted(int msecs) final { return m_handle->waitForStarted(msecs); } - bool waitForReadyRead(int msecs) final { return m_handle->waitForReadyRead(msecs); } - bool waitForFinished(int msecs) final { return m_handle->waitForFinished(msecs); } + virtual ProcessBlockingInterface *processBlockingInterface() const { return m_blockingImpl; } void doDefaultStart(const QString &program, const QStringList &arguments) final { @@ -476,6 +525,7 @@ private: const uint m_token = 0; // Lives in caller's thread. CallerHandle *m_handle = nullptr; + ProcessLauncherBlockingImpl *m_blockingImpl = nullptr; }; static ProcessImpl defaultProcessImpl() @@ -535,13 +585,15 @@ private: const ProcessResultData m_resultData; }; +class GeneralProcessBlockingImpl; + class ProcessInterfaceHandler : public QObject { public: - ProcessInterfaceHandler(QtcProcessPrivate *caller, ProcessInterface *process); + ProcessInterfaceHandler(GeneralProcessBlockingImpl *caller, ProcessInterface *process); // Called from caller's thread exclusively. - bool waitForSignal(int msecs, ProcessSignalType newSignal); + bool waitForSignal(ProcessSignalType newSignal, int msecs); void moveToCallerThread(); private: @@ -555,11 +607,44 @@ private: void handleDone(const ProcessResultData &data); void appendSignal(ProcessInterfaceSignal *newSignal); - QtcProcessPrivate *m_caller = nullptr; + GeneralProcessBlockingImpl *m_caller = nullptr; QMutex m_mutex; QWaitCondition m_waitCondition; }; +class GeneralProcessBlockingImpl : public ProcessBlockingInterface +{ +public: + GeneralProcessBlockingImpl(QtcProcessPrivate *parent); + + void flush() { flushSignals(takeAllSignals()); } + bool flushFor(ProcessSignalType signalType) { + return flushSignals(takeSignalsFor(signalType), &signalType); + } + + bool shouldFlush() const { QMutexLocker locker(&m_mutex); return !m_signals.isEmpty(); } + // Called from ProcessInterfaceHandler thread exclusively. + void appendSignal(ProcessInterfaceSignal *launcherSignal); + +private: + // Called from caller's thread exclusively + bool waitForSignal(ProcessSignalType newSignal, int msecs) final; + + QList takeAllSignals(); + QList takeSignalsFor(ProcessSignalType signalType); + bool flushSignals(const QList &signalList, + ProcessSignalType *signalType = nullptr); + + void handleStartedSignal(const StartedSignal *launcherSignal); + void handleReadyReadSignal(const ReadyReadSignal *launcherSignal); + void handleDoneSignal(const DoneSignal *launcherSignal); + + QtcProcessPrivate *m_caller = nullptr; + std::unique_ptr m_processHandler; + mutable QMutex m_mutex; + QList m_signals; +}; + class QtcProcessPrivate : public QObject { public: @@ -591,11 +676,18 @@ public: void setProcessInterface(ProcessInterface *process) { m_process.reset(process); - m_processHandler.reset(new ProcessInterfaceHandler(this, process)); + m_process->setParent(this); + connect(m_process.get(), &ProcessInterface::started, + this, &QtcProcessPrivate::handleStarted); + connect(m_process.get(), &ProcessInterface::readyRead, + this, &QtcProcessPrivate::handleReadyRead); + connect(m_process.get(), &ProcessInterface::done, + this, &QtcProcessPrivate::handleDone); - // In order to move the process into another thread together with handle - m_process->setParent(m_processHandler.get()); - m_processHandler->setParent(this); + m_blockingInterface.reset(process->processBlockingInterface()); + if (!m_blockingInterface) + m_blockingInterface.reset(new GeneralProcessBlockingImpl(this)); + m_blockingInterface->setParent(this); } CommandLine fullCommandLine() const @@ -624,14 +716,11 @@ public: } QtcProcess *q; - std::unique_ptr m_processHandler; + std::unique_ptr m_blockingInterface; std::unique_ptr m_process; ProcessSetupData m_setup; void slotTimeout(); - void handleStartedSignal(const StartedSignal *launcherSignal); - void handleReadyReadSignal(const ReadyReadSignal *launcherSignal); - void handleDoneSignal(const DoneSignal *launcherSignal); void handleStarted(qint64 processId, qint64 applicationMainThreadId); void handleReadyRead(const QByteArray &outputData, const QByteArray &errorData); void handleDone(const ProcessResultData &data); @@ -647,31 +736,11 @@ public: ProcessResult interpretExitCode(int exitCode); - // === ProcessInterfaceHandler related === - // Called from caller's thread exclusively - bool waitForSignal(int msecs, ProcessSignalType newSignal); - void flush() { flushSignals(takeAllSignals()); } - bool flushFor(ProcessSignalType signalType) { - return flushSignals(takeSignalsFor(signalType), &signalType); - } - - QList takeAllSignals(); - QList takeSignalsFor(ProcessSignalType signalType); - bool flushSignals(const QList &signalList, - ProcessSignalType *signalType = nullptr); - - bool shouldFlush() const { QMutexLocker locker(&m_mutex); return !m_signals.isEmpty(); } + bool waitForSignal(ProcessSignalType signalType, int msecs); Qt::ConnectionType connectionType() const; void sendControlSignal(ControlSignal controlSignal); - // Called from ProcessInterfaceHandler thread exclusively. - void appendSignal(ProcessInterfaceSignal *launcherSignal); - mutable QMutex m_mutex; - QList m_signals; QTimer m_killTimer; - - // ======================================= - QProcess::ProcessState m_state = QProcess::NotRunning; qint64 m_processId = 0; qint64 m_applicationMainThreadId = 0; @@ -692,10 +761,11 @@ public: Guard m_guard; }; -ProcessInterfaceHandler::ProcessInterfaceHandler(QtcProcessPrivate *caller, +ProcessInterfaceHandler::ProcessInterfaceHandler(GeneralProcessBlockingImpl *caller, ProcessInterface *process) : m_caller(caller) { + process->disconnect(); connect(process, &ProcessInterface::started, this, &ProcessInterfaceHandler::handleStarted); connect(process, &ProcessInterface::readyRead, @@ -705,7 +775,7 @@ ProcessInterfaceHandler::ProcessInterfaceHandler(QtcProcessPrivate *caller, } // Called from caller's thread exclusively. -bool ProcessInterfaceHandler::waitForSignal(int msecs, ProcessSignalType newSignal) +bool ProcessInterfaceHandler::waitForSignal(ProcessSignalType newSignal, int msecs) { QDeadlineTimer deadline(msecs); while (true) { @@ -769,17 +839,20 @@ void ProcessInterfaceHandler::appendSignal(ProcessInterfaceSignal *newSignal) } m_waitCondition.wakeOne(); // call in callers thread - QMetaObject::invokeMethod(m_caller, &QtcProcessPrivate::flush); + QMetaObject::invokeMethod(m_caller, &GeneralProcessBlockingImpl::flush); } -// Called from caller's thread exclusively -bool QtcProcessPrivate::waitForSignal(int msecs, ProcessSignalType newSignal) +GeneralProcessBlockingImpl::GeneralProcessBlockingImpl(QtcProcessPrivate *parent) + : m_caller(parent) + , m_processHandler(new ProcessInterfaceHandler(this, parent->m_process.get())) { - const QDeadlineTimer timeout(msecs); - const QDeadlineTimer currentKillTimeout(m_killTimer.remainingTime()); - const bool needsSplit = m_killTimer.isActive() ? timeout > currentKillTimeout : false; - const QDeadlineTimer mainTimeout = needsSplit ? currentKillTimeout : timeout; + // In order to move the process interface into another thread together with handle + parent->m_process.get()->setParent(m_processHandler.get()); + m_processHandler->setParent(this); +} +bool GeneralProcessBlockingImpl::waitForSignal(ProcessSignalType newSignal, int msecs) +{ m_processHandler->setParent(nullptr); QThread thread; @@ -789,12 +862,7 @@ bool QtcProcessPrivate::waitForSignal(int msecs, ProcessSignalType newSignal) // the caller here is blocked, so all signals should be buffered and we are going // to flush them from inside waitForSignal(). m_processHandler->moveToThread(&thread); - bool result = m_processHandler->waitForSignal(mainTimeout.remainingTime(), newSignal); - if (!result && needsSplit) { - m_killTimer.stop(); - sendControlSignal(ControlSignal::Kill); - result = m_processHandler->waitForSignal(timeout.remainingTime(), newSignal); - } + const bool result = m_processHandler->waitForSignal(newSignal, msecs); m_processHandler->moveToCallerThread(); m_processHandler->setParent(this); thread.quit(); @@ -803,14 +871,14 @@ bool QtcProcessPrivate::waitForSignal(int msecs, ProcessSignalType newSignal) } // Called from caller's thread exclusively -QList QtcProcessPrivate::takeAllSignals() +QList GeneralProcessBlockingImpl::takeAllSignals() { QMutexLocker locker(&m_mutex); return std::exchange(m_signals, {}); } // Called from caller's thread exclusively -QList QtcProcessPrivate::takeSignalsFor(ProcessSignalType signalType) +QList GeneralProcessBlockingImpl::takeSignalsFor(ProcessSignalType signalType) { // If we are flushing for ReadyRead or Done - flush all. if (signalType != ProcessSignalType::Started) @@ -840,7 +908,7 @@ QList QtcProcessPrivate::takeSignalsFor(ProcessSignalT } // Called from caller's thread exclusively -bool QtcProcessPrivate::flushSignals(const QList &signalList, +bool GeneralProcessBlockingImpl::flushSignals(const QList &signalList, ProcessSignalType *signalType) { bool signalMatched = false; @@ -866,14 +934,50 @@ bool QtcProcessPrivate::flushSignals(const QList &sign return signalMatched; } -// Called from caller's thread exclusively +void GeneralProcessBlockingImpl::handleStartedSignal(const StartedSignal *aSignal) +{ + m_caller->handleStarted(aSignal->processId(), aSignal->applicationMainThreadId()); +} + +void GeneralProcessBlockingImpl::handleReadyReadSignal(const ReadyReadSignal *aSignal) +{ + m_caller->handleReadyRead(aSignal->stdOut(), aSignal->stdErr()); +} + +void GeneralProcessBlockingImpl::handleDoneSignal(const DoneSignal *aSignal) +{ + m_caller->handleDone(aSignal->resultData()); +} + +// Called from ProcessInterfaceHandler thread exclusively. +void GeneralProcessBlockingImpl::appendSignal(ProcessInterfaceSignal *newSignal) +{ + QMutexLocker locker(&m_mutex); + m_signals.append(newSignal); +} + +bool QtcProcessPrivate::waitForSignal(ProcessSignalType newSignal, int msecs) +{ + const QDeadlineTimer timeout(msecs); + const QDeadlineTimer currentKillTimeout(m_killTimer.remainingTime()); + const bool needsSplit = m_killTimer.isActive() ? timeout > currentKillTimeout : false; + const QDeadlineTimer mainTimeout = needsSplit ? currentKillTimeout : timeout; + + bool result = m_blockingInterface->waitForSignal(newSignal, mainTimeout.remainingTime()); + if (!result && needsSplit) { + m_killTimer.stop(); + sendControlSignal(ControlSignal::Kill); + result = m_blockingInterface->waitForSignal(newSignal, timeout.remainingTime()); + } + return result; +} + Qt::ConnectionType QtcProcessPrivate::connectionType() const { return (m_process->thread() == thread()) ? Qt::DirectConnection : Qt::BlockingQueuedConnection; } -// Called from caller's thread exclusively void QtcProcessPrivate::sendControlSignal(ControlSignal controlSignal) { QTC_ASSERT(QThread::currentThread() == thread(), return); @@ -885,13 +989,6 @@ void QtcProcessPrivate::sendControlSignal(ControlSignal controlSignal) }, connectionType()); } -// Called from ProcessInterfaceHandler thread exclusively. -void QtcProcessPrivate::appendSignal(ProcessInterfaceSignal *newSignal) -{ - QMutexLocker locker(&m_mutex); - m_signals.append(newSignal); -} - void QtcProcessPrivate::clearForRun() { m_hangTimerCount = 0; @@ -1444,8 +1541,8 @@ bool QtcProcess::waitForStarted(int msecs) return true; if (d->m_state == QProcess::NotRunning) return false; - return s_waitForStarted.measureAndRun(&QtcProcessPrivate::waitForSignal, d, msecs, - ProcessSignalType::Started); + return s_waitForStarted.measureAndRun(&QtcProcessPrivate::waitForSignal, d, + ProcessSignalType::Started, msecs); } bool QtcProcess::waitForReadyRead(int msecs) @@ -1453,7 +1550,7 @@ bool QtcProcess::waitForReadyRead(int msecs) QTC_ASSERT(d->m_process, return false); if (d->m_state == QProcess::NotRunning) return false; - return d->waitForSignal(msecs, ProcessSignalType::ReadyRead); + return d->waitForSignal(ProcessSignalType::ReadyRead, msecs); } bool QtcProcess::waitForFinished(int msecs) @@ -1461,7 +1558,7 @@ bool QtcProcess::waitForFinished(int msecs) QTC_ASSERT(d->m_process, return false); if (d->m_state == QProcess::NotRunning) return false; - return d->waitForSignal(msecs, ProcessSignalType::Done); + return d->waitForSignal(ProcessSignalType::Done, msecs); } QByteArray QtcProcess::readAllStandardOutput() @@ -1511,9 +1608,9 @@ void QtcProcess::close() d->m_process->disconnect(); d->m_process.release()->deleteLater(); } - if (d->m_processHandler) { - d->m_processHandler->disconnect(); - d->m_processHandler.release()->deleteLater(); + if (d->m_blockingInterface) { + d->m_blockingInterface->disconnect(); + d->m_blockingInterface.release()->deleteLater(); } d->clearForRun(); } @@ -1854,22 +1951,6 @@ void QtcProcessPrivate::slotTimeout() } } -void QtcProcessPrivate::handleStartedSignal(const StartedSignal *aSignal) -{ - handleStarted(aSignal->processId(), aSignal->applicationMainThreadId()); -} - -void QtcProcessPrivate::handleReadyReadSignal(const ReadyReadSignal *aSignal) -{ - handleReadyRead(aSignal->stdOut(), aSignal->stdErr()); -} - -void QtcProcessPrivate::handleDoneSignal(const DoneSignal *aSignal) -{ - m_killTimer.stop(); - handleDone(aSignal->resultData()); -} - void QtcProcessPrivate::handleStarted(qint64 processId, qint64 applicationMainThreadId) { QTC_CHECK(m_state == QProcess::Starting); @@ -1908,6 +1989,7 @@ void QtcProcessPrivate::handleReadyRead(const QByteArray &outputData, const QByt void QtcProcessPrivate::handleDone(const ProcessResultData &data) { + m_killTimer.stop(); m_resultData = data; switch (m_state) { diff --git a/src/libs/utils/terminalprocess_p.h b/src/libs/utils/terminalprocess_p.h index f92d00f8448..32be83f0206 100644 --- a/src/libs/utils/terminalprocess_p.h +++ b/src/libs/utils/terminalprocess_p.h @@ -50,12 +50,6 @@ private: qint64 write(const QByteArray &) final { QTC_CHECK(false); return -1; } void sendControlSignal(ControlSignal controlSignal) final; - // 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; } - // OK, however, impl looks a bit different (!= NotRunning vs == Running). // Most probably changing it into (== Running) should be OK. bool isRunning() const; diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 7c450a7b90f..ba24dd7bea0 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -168,10 +168,6 @@ private: qint64 write(const QByteArray &data) override; void sendControlSignal(ControlSignal controlSignal) override; - bool waitForStarted(int msecs) override; - bool waitForReadyRead(int msecs) override; - bool waitForFinished(int msecs) override; - private: CommandLine fullLocalCommandLine(bool interactive); @@ -288,27 +284,6 @@ void DockerProcessImpl::sendControlSignal(ControlSignal controlSignal) {"kill", {QString("-%1").arg(signal), QString("%2").arg(m_remotePID)}}); } -bool DockerProcessImpl::waitForStarted(int msecs) -{ - Q_UNUSED(msecs) - QTC_CHECK(false); - return false; -} - -bool DockerProcessImpl::waitForReadyRead(int msecs) -{ - Q_UNUSED(msecs) - QTC_CHECK(false); - return false; -} - -bool DockerProcessImpl::waitForFinished(int msecs) -{ - Q_UNUSED(msecs) - QTC_CHECK(false); - return false; -} - IDeviceWidget *DockerDevice::createWidget() { return new DockerDeviceWidget(sharedFromThis()); diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 55be3fe0575..9f68025c688 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -497,27 +497,6 @@ qint64 SshProcessInterface::write(const QByteArray &data) return d->m_process.writeRaw(data); } -bool SshProcessInterface::waitForStarted(int msecs) -{ - Q_UNUSED(msecs) - QTC_CHECK(false); - return false; -} - -bool SshProcessInterface::waitForReadyRead(int msecs) -{ - Q_UNUSED(msecs) - QTC_CHECK(false); - return false; -} - -bool SshProcessInterface::waitForFinished(int msecs) -{ - Q_UNUSED(msecs) - QTC_CHECK(false); - return false; -} - LinuxProcessInterface::LinuxProcessInterface(const LinuxDevice *linuxDevice) : SshProcessInterface(linuxDevice) { diff --git a/src/plugins/remotelinux/sshprocessinterface.h b/src/plugins/remotelinux/sshprocessinterface.h index e60009ded2a..871c90d3ed6 100644 --- a/src/plugins/remotelinux/sshprocessinterface.h +++ b/src/plugins/remotelinux/sshprocessinterface.h @@ -60,10 +60,6 @@ private: qint64 write(const QByteArray &data) final; void sendControlSignal(Utils::ControlSignal controlSignal) override = 0; - bool waitForStarted(int msecs) final; - bool waitForReadyRead(int msecs) final; - bool waitForFinished(int msecs) final; - friend class SshProcessInterfacePrivate; SshProcessInterfacePrivate *d = nullptr; };