Commit 6c83981e authored by Vikas Pachdha's avatar Vikas Pachdha

iOS: Use kill system call instead of shell command

Change-Id: Ic1d327ca2ed83ee91f78434cc1974ec247751483
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent c14a24dc
......@@ -54,6 +54,7 @@
#include <QTimer>
#include <QXmlStreamReader>
#include <signal.h>
#include <string.h>
#include <errno.h>
......@@ -930,16 +931,13 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
"Install Xcode 8 or later.").arg(bundleId));
}
auto monitorPid = [this](QFutureInterface<int> &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<void> &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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment