iOS: Capture console output of launched app on iOS simulator

Task-number: QTCREATORBUG-17483
Change-Id: Id18c51e20cf8b396fc610918610f04d39ead28b0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Vikas Pachdha
2016-12-21 18:28:42 +01:00
parent fe0a091802
commit 54677f4985
3 changed files with 125 additions and 43 deletions

View File

@@ -108,7 +108,8 @@ private:
const Utils::FileName &bundlePath);
void launchApp(QFutureInterface<SimulatorControl::ResponseData> &fi, const QString &simUdid,
const QString &bundleIdentifier, bool waitForDebugger,
const QStringList &extraArgs);
const QStringList &extraArgs, const QString &stdoutPath,
const QString &stderrPath);
static QList<IosDeviceType> availableDevices;
friend class SimulatorControl;
@@ -196,10 +197,11 @@ SimulatorControl::installApp(const QString &simUdid, const Utils::FileName &bund
QFuture<SimulatorControl::ResponseData>
SimulatorControl::launchApp(const QString &simUdid, const QString &bundleIdentifier,
bool waitForDebugger, const QStringList &extraArgs) const
bool waitForDebugger, const QStringList &extraArgs,
const QString &stdoutPath, const QString &stderrPath) const
{
return Utils::runAsync(&SimulatorControlPrivate::launchApp, d, simUdid, bundleIdentifier,
waitForDebugger, extraArgs);
waitForDebugger, extraArgs, stdoutPath, stderrPath);
}
QList<IosDeviceType> SimulatorControlPrivate::availableDevices;
@@ -342,12 +344,20 @@ void SimulatorControlPrivate::installApp(QFutureInterface<SimulatorControl::Resp
void SimulatorControlPrivate::launchApp(QFutureInterface<SimulatorControl::ResponseData> &fi,
const QString &simUdid, const QString &bundleIdentifier,
bool waitForDebugger, const QStringList &extraArgs)
bool waitForDebugger, const QStringList &extraArgs,
const QString &stdoutPath, const QString &stderrPath)
{
SimulatorControl::ResponseData response(simUdid);
if (!bundleIdentifier.isEmpty() && !fi.isCanceled()) {
QStringList args({QStringLiteral("launch"), simUdid, bundleIdentifier});
// simctl usage documentation : Note: Log output is often directed to stderr, not stdout.
if (!stdoutPath.isEmpty())
args.insert(1, QStringLiteral("--stderr=%1").arg(stdoutPath));
if (!stderrPath.isEmpty())
args.insert(1, QStringLiteral("--stdout=%1").arg(stderrPath));
if (waitForDebugger)
args.insert(1, QStringLiteral("-w"));