From de328378a8c9e5b9d635b8247794895c1fb7b98b Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 17 Feb 2022 18:30:35 +0100 Subject: [PATCH] ApplicationLauncher: Move started() connection to more common code Even though so local specific code needs to stay. Change-Id: I57b66e746861716bd95592c8aeb03d627d17fc92 Reviewed-by: Jarek Kobus --- .../projectexplorer/applicationlauncher.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 333e1c6c0d5..8066955d90e 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -77,7 +77,6 @@ public: void handleStandardError(); // Local - void handleProcessStarted(); void localProcessError(QProcess::ProcessError error); void cannotRetrieveLocalDebugOutput(); void checkLocalDebugOutput(qint64 pid, const QString &message); @@ -323,12 +322,6 @@ QProcess::ExitStatus ApplicationLauncher::exitStatus() const return d->m_exitStatus; } -void ApplicationLauncherPrivate::handleProcessStarted() -{ - m_listeningPid = applicationPID(); - emit q->processStarted(); -} - void ApplicationLauncher::start() { d->start(IDevice::ConstPtr(), true); @@ -349,8 +342,6 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc if (m_isLocal) { m_process.reset(new QtcProcess(this)); - connect(m_process.get(), &QtcProcess::started, - this, &ApplicationLauncherPrivate::handleProcessStarted); connect(m_process.get(), &QtcProcess::finished, this, [this] { m_exitCode = m_process->exitCode(); m_exitStatus = m_process->exitStatus(); @@ -360,7 +351,6 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc connect(m_process.get(), &QtcProcess::errorOccurred, this, &ApplicationLauncherPrivate::localProcessError); - // Work around QTBUG-17529 (QtDeclarative fails with 'File name case mismatch' ...) const FilePath fixedPath = m_runnable.workingDirectory.normalizedPathName(); m_process->setWorkingDirectory(fixedPath); @@ -412,8 +402,6 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc m_stopRequested = false; m_process.reset(device->createProcess(this)); - connect(m_process.get(), &QtcProcess::started, - q, &ApplicationLauncher::processStarted); connect(m_process.get(), &QtcProcess::errorOccurred, this, &ApplicationLauncherPrivate::handleApplicationError); connect(m_process.get(), &QtcProcess::finished, @@ -429,6 +417,13 @@ void ApplicationLauncherPrivate::start(const IDevice::ConstPtr &device, bool loc else m_outputCodec = QTextCodec::codecForName("utf8"); + connect(m_process.get(), &QtcProcess::started, this, [this] { + // The local bit affects only WinDebugInterface. + if (m_isLocal) + m_listeningPid = applicationPID(); + emit q->processStarted(); + }); + m_process->setProcessChannelMode(m_processChannelMode); if (m_processChannelMode == QProcess::SeparateChannels) { connect(m_process.get(), &QtcProcess::readyReadStandardError,