From 53a5939d68801c4d2bbc6195d18669d6f1dc9dda Mon Sep 17 00:00:00 2001 From: Andrey Goncharov Date: Tue, 30 May 2023 09:47:19 -0700 Subject: [PATCH] Add one more fallback for the adb path Summary: It seems that adb path has changed on the jest-e2e side. That might case the flipper e2e test failure. With this fallback we have granular control of the path. Reviewed By: antonk52 Differential Revision: D46278512 fbshipit-source-id: 97310459de54eeb003eefb3a3ff06af8b13bebae --- .../src/devices/android/adbClient.tsx | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/desktop/flipper-server-core/src/devices/android/adbClient.tsx b/desktop/flipper-server-core/src/devices/android/adbClient.tsx index 4c72468be..67d6c988a 100644 --- a/desktop/flipper-server-core/src/devices/android/adbClient.tsx +++ b/desktop/flipper-server-core/src/devices/android/adbClient.tsx @@ -51,12 +51,20 @@ async function startAdbServer(androidHome: string) { const adbPath = path.resolve(androidHome, 'platform-tools', 'adb'); const args = ['start-server']; - return execFile(adbPath, args).catch((error) => { - if (error.code == 'ENOENT') { - console.info('falling back to the alternative adb path'); - return execFile(path.resolve(androidHome, 'adb'), args); - } + return execFile(adbPath, args) + .catch((error) => { + if (error.code == 'ENOENT') { + console.info('falling back to the alternative adb path'); + return execFile(path.resolve(androidHome, 'adb'), args); + } + throw error; + }) + .catch((error) => { + if (error.code == 'ENOENT') { + console.info('falling back to the adb path of last resort'); + return execFile(androidHome, args); + } - throw error; - }); + throw error; + }); }