forked from qt-creator/qt-creator
iOS: Use kill system call instead of shell command
Change-Id: Ic1d327ca2ed83ee91f78434cc1974ec247751483 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -54,6 +54,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QXmlStreamReader>
|
#include <QXmlStreamReader>
|
||||||
|
|
||||||
|
#include <signal.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
@@ -930,16 +931,13 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext
|
|||||||
"Install Xcode 8 or later.").arg(bundleId));
|
"Install Xcode 8 or later.").arg(bundleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto monitorPid = [this](QFutureInterface<int> &fi, qint64 pid) {
|
auto monitorPid = [this](QFutureInterface<void> &fi, qint64 pid) {
|
||||||
int exitCode = 0;
|
#ifdef Q_OS_UNIX
|
||||||
const QStringList args({QStringLiteral("-0"), QString::number(pid)});
|
do {
|
||||||
Utils::SynchronousProcess pKill;
|
|
||||||
while (!fi.isCanceled() && exitCode == 0) {
|
|
||||||
// Poll every 1 sec to check whether the app is running.
|
// Poll every 1 sec to check whether the app is running.
|
||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
Utils::SynchronousProcessResponse resp = pKill.runBlocking(QStringLiteral("kill"), args);
|
} while (!fi.isCanceled() && kill(pid, 0) == 0);
|
||||||
exitCode = resp.exitCode;
|
#endif
|
||||||
}
|
|
||||||
// Future is cancelled if the app is stopped from the qt creator.
|
// Future is cancelled if the app is stopped from the qt creator.
|
||||||
if (!fi.isCanceled())
|
if (!fi.isCanceled())
|
||||||
stop(0);
|
stop(0);
|
||||||
|
Reference in New Issue
Block a user