forked from qt-creator/qt-creator
iOS: Move process id gathering from devicectl to a function
And add a test to document what we expect from devicectl. Change-Id: Ic69af99a472976a6c06801a646af59f8139d5624 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
@@ -96,4 +96,15 @@ Utils::expected_str<QUrl> parseAppInfo(const QByteArray &rawOutput, const QStrin
|
||||
return {};
|
||||
}
|
||||
|
||||
Utils::expected_str<qint64> parseProcessIdentifier(const QByteArray &rawOutput)
|
||||
{
|
||||
const expected_str<QJsonValue> result = parseDevicectlResult(rawOutput);
|
||||
if (!result)
|
||||
return make_unexpected(result.error());
|
||||
const QJsonArray matchingProcesses = (*result)["runningProcesses"].toArray();
|
||||
if (matchingProcesses.size() > 0)
|
||||
return matchingProcesses.first()["processIdentifier"].toInteger(-1);
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace Ios::Internal
|
||||
|
||||
Reference in New Issue
Block a user