If one method of finding Dart VM fails for CoreDevice, wait for the other method (#139754)
For CoreDevices we use a combination of mDNS and device logs to find the Dart VM url. If mDNS fails first, it will cause the launch to fail even though the device logs may be able to find the url. So if one of the methods fails, wait for the other method before failing the launch. Fixes https://github.com/flutter/flutter/issues/139685.
This commit is contained in:
committed by
GitHub
parent
0c0b77f342
commit
82bc9ca327
@@ -680,6 +680,14 @@ class IOSDevice extends Device {
|
||||
localUri = await Future.any(
|
||||
<Future<Uri?>>[vmUrlFromMDns, vmUrlFromLogs]
|
||||
);
|
||||
|
||||
// If the first future to return is null, wait for the other to complete.
|
||||
if (localUri == null) {
|
||||
final List<Uri?> vmUrls = await Future.wait(
|
||||
<Future<Uri?>>[vmUrlFromMDns, vmUrlFromLogs]
|
||||
);
|
||||
localUri = vmUrls.where((Uri? vmUrl) => vmUrl != null).firstOrNull;
|
||||
}
|
||||
} else {
|
||||
localUri = await vmServiceDiscovery?.uri;
|
||||
// If the `ios-deploy` debugger loses connection before it finds the
|
||||
|
||||
Reference in New Issue
Block a user