From 7194e968a8d9d54602d7bf475a928d4f35c0256c Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Tue, 28 Feb 2017 15:31:09 +0100 Subject: [PATCH] QtcProcess: fix cancel builds at windows kill terminate and interrupt are reimplemented for QtcProcess to send the commands to all children, we need to call them in case QtcProcess Change-Id: I6bc9b240c30634bfb7f81e54f293f5ef6b5c1792 Reviewed-by: Tobias Hunger --- src/plugins/coreplugin/reaper.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/plugins/coreplugin/reaper.cpp b/src/plugins/coreplugin/reaper.cpp index 1cc9d12c0c7..907542928ba 100644 --- a/src/plugins/coreplugin/reaper.cpp +++ b/src/plugins/coreplugin/reaper.cpp @@ -26,6 +26,7 @@ #include "reaper.h" #include "reaper_p.h" +#include #include #include @@ -36,6 +37,24 @@ namespace Internal { static ReaperPrivate *d = nullptr; +namespace { +void killProcess(QProcess *process) +{ + if (Utils::QtcProcess *qtcProcess = qobject_cast(process)) + qtcProcess->kill(); + else + process->kill(); +} + +void terminateProcess(QProcess *process) +{ + if (Utils::QtcProcess *qtcProcess = qobject_cast(process)) + qtcProcess->terminate(); + else + process->terminate(); +} +} // namespace + ProcessReaper::ProcessReaper(QProcess *p, int timeoutMs) : m_process(p) { d->m_reapers.append(this); @@ -79,12 +98,12 @@ void ProcessReaper::nextIteration() if (state == QProcess::Starting) { if (m_lastState == QProcess::Starting) - m_process->kill(); + killProcess(m_process); } else if (state == QProcess::Running) { if (m_lastState == QProcess::Running) - m_process->kill(); + killProcess(m_process); else - m_process->terminate(); + terminateProcess(m_process); } m_lastState = state;