[fuchsia] - update getting local host address logic (#75981)
This commit is contained in:
@@ -68,12 +68,9 @@ class FuchsiaDevFinder {
|
||||
|
||||
/// Returns the address of the named device.
|
||||
///
|
||||
/// If local is true, then gives the address by which the device reaches the
|
||||
/// host.
|
||||
///
|
||||
/// The string [deviceName] should be the name of the device from the
|
||||
/// 'list' command, e.g. 'scare-cable-skip-joy'.
|
||||
Future<String> resolve(String deviceName, {bool local = false}) async {
|
||||
Future<String> resolve(String deviceName) async {
|
||||
if (_fuchsiaArtifacts.devFinder == null ||
|
||||
!_fuchsiaArtifacts.devFinder.existsSync()) {
|
||||
throwToolExit('Fuchsia device-finder tool not found.');
|
||||
@@ -81,7 +78,6 @@ class FuchsiaDevFinder {
|
||||
final List<String> command = <String>[
|
||||
_fuchsiaArtifacts.devFinder.path,
|
||||
'resolve',
|
||||
if (local) '-local',
|
||||
'-device-limit', '1',
|
||||
deviceName,
|
||||
];
|
||||
|
||||
@@ -211,7 +211,6 @@ class FuchsiaDevices extends PollingDeviceDiscovery {
|
||||
final String name = words[1];
|
||||
final String resolvedHost = await _fuchsiaSdk.fuchsiaDevFinder.resolve(
|
||||
name,
|
||||
local: false,
|
||||
);
|
||||
if (resolvedHost == null) {
|
||||
_logger.printError('Failed to resolve host for Fuchsia device `$name`');
|
||||
@@ -297,14 +296,7 @@ class FuchsiaDevice extends Device {
|
||||
}
|
||||
// Stop the app if it's currently running.
|
||||
await stopApp(package);
|
||||
final String host = await fuchsiaSdk.fuchsiaDevFinder.resolve(
|
||||
name,
|
||||
local: true,
|
||||
);
|
||||
if (host == null) {
|
||||
globals.printError('Failed to resolve host for Fuchsia device');
|
||||
return LaunchResult.failed();
|
||||
}
|
||||
final String host = await hostAddress;
|
||||
// Find out who the device thinks we are.
|
||||
final int port = await globals.os.findFreePort();
|
||||
if (port == 0) {
|
||||
|
||||
Reference in New Issue
Block a user