iOSDeviceManager getSimulators converted to async

Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47911997

fbshipit-source-id: df2cab1986d5ddc7f2bc4e857c76cd178f6a7ccb
This commit is contained in:
Lorenzo Blasa
2023-07-31 03:55:58 -07:00
committed by Facebook GitHub Bot
parent 1f63a25027
commit e9bae419a7

View File

@@ -167,8 +167,10 @@ export class IOSDeviceManager {
} }
} }
getSimulators(bootedOnly: boolean): Promise<Array<IOSDeviceParams>> { async getSimulators(bootedOnly: boolean): Promise<Array<IOSDeviceParams>> {
return this.simctlBridge.getActiveDevices(bootedOnly).catch((e: Error) => { try {
return await this.simctlBridge.getActiveDevices(bootedOnly);
} catch (e) {
console.warn('Failed to query simulators:', e); console.warn('Failed to query simulators:', e);
if (e.message.includes('Xcode license agreements')) { if (e.message.includes('Xcode license agreements')) {
this.flipperServer.emit('notification', { this.flipperServer.emit('notification', {
@@ -178,8 +180,8 @@ export class IOSDeviceManager {
'The Xcode license agreement has changed. You need to either open Xcode and agree to the terms or run `sudo xcodebuild -license` in a Terminal to allow simulators to work with Flipper.', 'The Xcode license agreement has changed. You need to either open Xcode and agree to the terms or run `sudo xcodebuild -license` in a Terminal to allow simulators to work with Flipper.',
}); });
} }
return Promise.resolve([]); return [];
}); }
} }
private queryDevicesForever(bridge: IOSBridge) { private queryDevicesForever(bridge: IOSBridge) {