From 6c83981ee69f2b7fba4f3c7d3e260f257eae90f7 Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Wed, 21 Dec 2016 18:37:39 +0100 Subject: [PATCH] iOS: Use kill system call instead of shell command Change-Id: Ic1d327ca2ed83ee91f78434cc1974ec247751483 Reviewed-by: Eike Ziller --- src/plugins/ios/iostoolhandler.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index b1c1773cfc1..64c362de47f 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -54,6 +54,7 @@ #include #include +#include #include #include @@ -930,16 +931,13 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext "Install Xcode 8 or later.").arg(bundleId)); } - auto monitorPid = [this](QFutureInterface &fi, qint64 pid) { - int exitCode = 0; - const QStringList args({QStringLiteral("-0"), QString::number(pid)}); - Utils::SynchronousProcess pKill; - while (!fi.isCanceled() && exitCode == 0) { + auto monitorPid = [this](QFutureInterface &fi, qint64 pid) { +#ifdef Q_OS_UNIX + do { // Poll every 1 sec to check whether the app is running. QThread::msleep(1000); - Utils::SynchronousProcessResponse resp = pKill.runBlocking(QStringLiteral("kill"), args); - exitCode = resp.exitCode; - } + } while (!fi.isCanceled() && kill(pid, 0) == 0); +#endif // Future is cancelled if the app is stopped from the qt creator. if (!fi.isCanceled()) stop(0);