forked from qt-creator/qt-creator
ProjectExplorer: Dissolve ApplicationLauncherPrivate::localProcessDone
The odd delay seems to have no or different reasons in both places. Aim at handling them one by one. Change-Id: I4682954eb67a09dead95d4df16c2ab4da45a7fb7 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -80,7 +80,6 @@ public:
|
|||||||
void readLocalStandardError();
|
void readLocalStandardError();
|
||||||
void cannotRetrieveLocalDebugOutput();
|
void cannotRetrieveLocalDebugOutput();
|
||||||
void checkLocalDebugOutput(qint64 pid, const QString &message);
|
void checkLocalDebugOutput(qint64 pid, const QString &message);
|
||||||
void localProcessDone(int, QProcess::ExitStatus);
|
|
||||||
qint64 applicationPID() const;
|
qint64 applicationPID() const;
|
||||||
bool isRunning() const;
|
bool isRunning() const;
|
||||||
|
|
||||||
@@ -180,17 +179,18 @@ void ApplicationLauncher::stop()
|
|||||||
|
|
||||||
void ApplicationLauncherPrivate::stop()
|
void ApplicationLauncherPrivate::stop()
|
||||||
{
|
{
|
||||||
|
m_exitStatus = QProcess::CrashExit;
|
||||||
if (m_isLocal) {
|
if (m_isLocal) {
|
||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
return;
|
return;
|
||||||
QTC_ASSERT(m_process, return);
|
QTC_ASSERT(m_process, return);
|
||||||
|
m_listeningPid = 0;
|
||||||
m_process->stopProcess();
|
m_process->stopProcess();
|
||||||
localProcessDone(0, QProcess::CrashExit);
|
QTimer::singleShot(100, this, [this] { emit q->finished(); });
|
||||||
} else {
|
} else {
|
||||||
if (m_stopRequested)
|
if (m_stopRequested)
|
||||||
return;
|
return;
|
||||||
m_stopRequested = true;
|
m_stopRequested = true;
|
||||||
m_exitStatus = QProcess::CrashExit;
|
|
||||||
emit q->appendMessage(ApplicationLauncher::tr("User requested stop. Shutting down..."),
|
emit q->appendMessage(ApplicationLauncher::tr("User requested stop. Shutting down..."),
|
||||||
Utils::NormalMessageFormat);
|
Utils::NormalMessageFormat);
|
||||||
switch (m_state) {
|
switch (m_state) {
|
||||||
@@ -310,16 +310,6 @@ void ApplicationLauncherPrivate::checkLocalDebugOutput(qint64 pid, const QString
|
|||||||
emit q->appendMessage(message, DebugFormat);
|
emit q->appendMessage(message, DebugFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationLauncherPrivate::localProcessDone(int exitCode, QProcess::ExitStatus status)
|
|
||||||
{
|
|
||||||
QTimer::singleShot(100, this, [this, exitCode, status]() {
|
|
||||||
m_listeningPid = 0;
|
|
||||||
m_exitCode = exitCode;
|
|
||||||
m_exitStatus = status;
|
|
||||||
emit q->finished();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput()
|
QString ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput()
|
||||||
{
|
{
|
||||||
return tr("Cannot retrieve debugging output.") + QLatin1Char('\n');
|
return tr("Cannot retrieve debugging output.") + QLatin1Char('\n');
|
||||||
@@ -374,7 +364,10 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc
|
|||||||
connect(m_process.get(), &QtcProcess::started,
|
connect(m_process.get(), &QtcProcess::started,
|
||||||
this, &ApplicationLauncherPrivate::handleProcessStarted);
|
this, &ApplicationLauncherPrivate::handleProcessStarted);
|
||||||
connect(m_process.get(), &QtcProcess::finished, this, [this] {
|
connect(m_process.get(), &QtcProcess::finished, this, [this] {
|
||||||
localProcessDone(m_process->exitCode(), m_process->exitStatus());
|
m_exitCode = m_process->exitCode();
|
||||||
|
m_exitStatus = m_process->exitStatus();
|
||||||
|
m_listeningPid = 0;
|
||||||
|
QTimer::singleShot(100, this, [this] { emit q->finished(); });
|
||||||
});
|
});
|
||||||
connect(m_process.get(), &QtcProcess::errorOccurred,
|
connect(m_process.get(), &QtcProcess::errorOccurred,
|
||||||
this, &ApplicationLauncherPrivate::localProcessError);
|
this, &ApplicationLauncherPrivate::localProcessError);
|
||||||
|
Reference in New Issue
Block a user