Unverified Commit b771294c authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Use idevice_id for devicelab iOS device lookups (#13652)

This replaces the use of ideviceinfo (whose output was then filtered for
device IDs) with an invocation idevice_id -l, which returns the list
directly, one per line.
parent 68bf4b3c
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:math' as math;
......@@ -309,13 +310,12 @@ class IosDeviceDiscovery implements DeviceDiscovery {
@override
Future<List<String>> discoverDevices() async {
// TODO(yjbanov): use the -k UniqueDeviceID option, which requires much less parsing.
final List<String> iosDeviceIDs = grep('UniqueDeviceID', from: await eval('ideviceinfo', <String>[]))
.map((String line) => line.split(' ').last).toList();
final List<String> iosDeviceIDs = LineSplitter.split(await eval('idevice_id', <String>['-l']))
.map((String line) => line.trim())
.where((String line) => line.isNotEmpty)
.toList();
if (iosDeviceIDs.isEmpty)
throw 'No connected iOS devices found.';
return iosDeviceIDs;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment