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 <tobias.hunger@qt.io>
This commit is contained in:
Tim Jenssen
2017-02-28 15:31:09 +01:00
parent 6c8c624450
commit 7194e968a8

View File

@@ -26,6 +26,7 @@
#include "reaper.h"
#include "reaper_p.h"
#include <utils/qtcprocess.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -36,6 +37,24 @@ namespace Internal {
static ReaperPrivate *d = nullptr;
namespace {
void killProcess(QProcess *process)
{
if (Utils::QtcProcess *qtcProcess = qobject_cast<Utils::QtcProcess*>(process))
qtcProcess->kill();
else
process->kill();
}
void terminateProcess(QProcess *process)
{
if (Utils::QtcProcess *qtcProcess = qobject_cast<Utils::QtcProcess*>(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;