AndroidDevice, transform to async function

Summary: ^

Reviewed By: lawrencelomax

Differential Revision: D47331809

fbshipit-source-id: 819aefd1703cefc24b71216b946ca66bed3f5db1
This commit is contained in:
Lorenzo Blasa
2023-07-11 04:04:37 -07:00
committed by Facebook GitHub Bot
parent 994b472750
commit 564d62d8d5

View File

@@ -85,20 +85,20 @@ export default class AndroidDevice
); );
} }
reverse(ports: number[]): Promise<void> { async reverse(ports: number[]): Promise<void> {
return Promise.all( await Promise.all(
ports.map((port) => ports.map((port) =>
this.adb.reverse(this.serial, `tcp:${port}`, `tcp:${port}`), this.adb.reverse(this.serial, `tcp:${port}`, `tcp:${port}`),
), ),
).then(() => { );
return;
});
} }
clearLogs(): Promise<void> { async clearLogs(): Promise<void> {
return this.executeShellOrDie(['logcat', '-c']).catch((e) => { try {
return await this.executeShellOrDie(['logcat', '-c']);
} catch (e) {
console.warn('Failed to clear logs:', e); console.warn('Failed to clear logs:', e);
}); }
} }
async navigateToLocation(location: string) { async navigateToLocation(location: string) {