ProjectExplorer: Be more transparent about how we stop a process

Forward the information about the two-stage stop procedure to the user.

Change-Id: I5facd44d2fa6a4db3de09936f07f69840344eb03
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2024-08-22 13:47:35 +02:00
parent b7489fb55a
commit 9970ba0a6c
3 changed files with 10 additions and 0 deletions

View File

@@ -784,6 +784,7 @@ public:
m_killTimer.setSingleShot(true); m_killTimer.setSingleShot(true);
connect(&m_killTimer, &QTimer::timeout, this, [this] { connect(&m_killTimer, &QTimer::timeout, this, [this] {
m_killTimer.stop(); m_killTimer.stop();
emit q->stoppingForcefully();
sendControlSignal(ControlSignal::Kill); sendControlSignal(ControlSignal::Kill);
}); });
setupDebugLog(); setupDebugLog();
@@ -1658,6 +1659,7 @@ void Process::stop()
if (state() == QProcess::NotRunning) if (state() == QProcess::NotRunning)
return; return;
emit requestingStop();
d->sendControlSignal(ControlSignal::Terminate); d->sendControlSignal(ControlSignal::Terminate);
d->m_killTimer.start(d->m_process->m_setup.m_reaperTimeout); d->m_killTimer.start(d->m_process->m_setup.m_reaperTimeout);
} }

View File

@@ -199,6 +199,8 @@ signals:
void readyReadStandardError(); void readyReadStandardError();
void textOnStandardOutput(const QString &text); void textOnStandardOutput(const QString &text);
void textOnStandardError(const QString &text); void textOnStandardError(const QString &text);
void requestingStop();
void stoppingForcefully();
private: private:
friend QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug str, const Process &r); friend QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug str, const Process &r);

View File

@@ -1296,6 +1296,12 @@ SimpleTargetRunnerPrivate::SimpleTargetRunnerPrivate(SimpleTargetRunner *parent)
this, &SimpleTargetRunnerPrivate::handleStandardError); this, &SimpleTargetRunnerPrivate::handleStandardError);
connect(&m_process, &Process::readyReadStandardOutput, connect(&m_process, &Process::readyReadStandardOutput,
this, &SimpleTargetRunnerPrivate::handleStandardOutput); this, &SimpleTargetRunnerPrivate::handleStandardOutput);
connect(&m_process, &Process::requestingStop, this, [this] {
q->appendMessage(Tr::tr("Requesting process to stop ...."), NormalMessageFormat);
});
connect(&m_process, &Process::stoppingForcefully, this, [this] {
q->appendMessage(Tr::tr("Stopping process forcefully ...."), NormalMessageFormat);
});
m_waitForDoneTimer.setSingleShot(true); m_waitForDoneTimer.setSingleShot(true);
connect(&m_waitForDoneTimer, &QTimer::timeout, this, [this] { connect(&m_waitForDoneTimer, &QTimer::timeout, this, [this] {