Use QtcProcess in IosSimulator

Change-Id: I7e31a2702512802e7670e79ff096e4cc191d42a3
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2021-11-03 14:47:44 +01:00
parent e6d31c2b37
commit 910c71b59b

View File

@@ -29,10 +29,10 @@
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <utils/port.h> #include <utils/port.h>
#include <utils/qtcprocess.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QMapIterator> #include <QMapIterator>
#include <QProcess>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -80,13 +80,13 @@ Utils::Port IosSimulator::nextPort() const
// use qrand instead? // use qrand instead?
if (++m_lastPort >= Constants::IOS_SIMULATOR_PORT_END) if (++m_lastPort >= Constants::IOS_SIMULATOR_PORT_END)
m_lastPort = Constants::IOS_SIMULATOR_PORT_START; m_lastPort = Constants::IOS_SIMULATOR_PORT_START;
QProcess portVerifier; Utils::QtcProcess portVerifier;
// this is a bit too broad (it does not check just listening sockets, but also connections // this is a bit too broad (it does not check just listening sockets, but also connections
// to that port from this computer) // to that port from this computer)
portVerifier.start(QLatin1String("lsof"), {"-n", "-P", "-i", QString(":%1").arg(m_lastPort) }); portVerifier.setCommand({"lsof", {"-n", "-P", "-i", QString(":%1").arg(m_lastPort)}});
portVerifier.start();
if (!portVerifier.waitForStarted()) if (!portVerifier.waitForStarted())
break; break;
portVerifier.closeWriteChannel();
if (!portVerifier.waitForFinished()) if (!portVerifier.waitForFinished())
break; break;
if (portVerifier.exitStatus() != QProcess::NormalExit if (portVerifier.exitStatus() != QProcess::NormalExit