iOS: Move launch result from devicectl to a function

And add a test to document what we expect from devicectl.

Change-Id: I1a7f03c50393b99eddb2bfd34b5857e15b28d0a7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Eike Ziller
2024-02-01 14:21:03 +01:00
parent e32d3da321
commit a7a06d6f79
4 changed files with 85 additions and 11 deletions

View File

@@ -107,4 +107,17 @@ Utils::expected_str<qint64> parseProcessIdentifier(const QByteArray &rawOutput)
return -1;
}
Utils::expected_str<qint64> parseLaunchResult(const QByteArray &rawOutput)
{
const Utils::expected_str<QJsonValue> result = parseDevicectlResult(rawOutput);
if (!result)
return make_unexpected(result.error());
const qint64 pid = (*result)["process"]["processIdentifier"].toInteger(-1);
if (pid < 0) {
// something unexpected happened ...
return make_unexpected(Tr::tr("devicectl returned unexpected output ... running failed."));
}
return pid;
}
} // namespace Ios::Internal