ProjectExplorer: Fix re-run from the output pane

Amends 18fdad280a.

Change-Id: I6c21ad35282d008b70bdb1e0dbf06deaba5f9829
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-01-31 17:59:00 +01:00
committed by Christian Kandeler
parent ef003ba769
commit 2d0225d978

View File

@@ -100,7 +100,7 @@ public:
bool m_runAsRoot = false; bool m_runAsRoot = false;
// Local // Local
QtcProcess *m_localProcess = nullptr; std::unique_ptr<QtcProcess> m_localProcess;
bool m_useTerminal = false; bool m_useTerminal = false;
QProcess::ProcessChannelMode m_processChannelMode; QProcess::ProcessChannelMode m_processChannelMode;
// Keep track whether we need to emit a finished signal // Keep track whether we need to emit a finished signal
@@ -334,27 +334,26 @@ void ApplicationLauncherPrivate::start(const Runnable &runnable, const IDevice::
m_isLocal = local; m_isLocal = local;
if (m_isLocal) { if (m_isLocal) {
QTC_ASSERT(!m_localProcess, return);
const QtcProcess::TerminalMode terminalMode = m_useTerminal const QtcProcess::TerminalMode terminalMode = m_useTerminal
? QtcProcess::TerminalOn : QtcProcess::TerminalOff; ? QtcProcess::TerminalOn : QtcProcess::TerminalOff;
m_localProcess = new QtcProcess(terminalMode, this); m_localProcess.reset(new QtcProcess(terminalMode, this));
m_localProcess->setProcessChannelMode(m_processChannelMode); m_localProcess->setProcessChannelMode(m_processChannelMode);
if (m_processChannelMode == QProcess::SeparateChannels) { if (m_processChannelMode == QProcess::SeparateChannels) {
connect(m_localProcess, &QtcProcess::readyReadStandardError, connect(m_localProcess.get(), &QtcProcess::readyReadStandardError,
this, &ApplicationLauncherPrivate::readLocalStandardError); this, &ApplicationLauncherPrivate::readLocalStandardError);
} }
if (!m_useTerminal) { if (!m_useTerminal) {
connect(m_localProcess, &QtcProcess::readyReadStandardOutput, connect(m_localProcess.get(), &QtcProcess::readyReadStandardOutput,
this, &ApplicationLauncherPrivate::readLocalStandardOutput); this, &ApplicationLauncherPrivate::readLocalStandardOutput);
} }
connect(m_localProcess, &QtcProcess::started, connect(m_localProcess.get(), &QtcProcess::started,
this, &ApplicationLauncherPrivate::handleProcessStarted); this, &ApplicationLauncherPrivate::handleProcessStarted);
connect(m_localProcess, &QtcProcess::finished, this, [this] { connect(m_localProcess.get(), &QtcProcess::finished, this, [this] {
localProcessDone(m_localProcess->exitCode(), m_localProcess->exitStatus()); localProcessDone(m_localProcess->exitCode(), m_localProcess->exitStatus());
}); });
connect(m_localProcess, &QtcProcess::errorOccurred, connect(m_localProcess.get(), &QtcProcess::errorOccurred,
this, &ApplicationLauncherPrivate::localProcessError); this, &ApplicationLauncherPrivate::localProcessError);