From ddb4e70c2a9ec254f2351524aee7bea6cd1db206 Mon Sep 17 00:00:00 2001 From: Ranesh Saha Date: Fri, 12 Nov 2021 08:06:03 -0800 Subject: [PATCH] =?UTF-8?q?Updating=20splitting=20of=20avd=20names=20to=20?= =?UTF-8?q?work=20on=20Windows=20and=20Unix=20based=20sys=E2=80=A6=20(#304?= =?UTF-8?q?1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: …tems When trying to start an android emulator in Windows, there is a failure in trying to read `.ini`. The reason for this is because when we run `\tools\emulator.exe -list-avds`, a split is performed with the new line character (`\n`). Unfortunately, this does not work for Windows, which uses `\r\n` as the new line termination. This results in a carriage return remaining on each output string, which results in trying to access ` .ini`, which is an invalid path. The fix is to update the split to use a regex that is compatible for both Unix and Windows based systems. ## Changelog Updating splitting of avd names to work on Windows and Unix based systems Pull Request resolved: https://github.com/facebook/flipper/pull/3041 Test Plan: Verified the avd names didn't have any trailing whitespace, and the emulator is able to launch. Reviewed By: mweststrate Differential Revision: D32387162 Pulled By: nikoant fbshipit-source-id: 0900bee17b225cfa5484a29c96f8e2c1c2e31477 --- .../src/devices/android/androidDeviceManager.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx b/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx index e5501a0cd..94b53ce9f 100644 --- a/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx +++ b/desktop/flipper-server-core/src/devices/android/androidDeviceManager.tsx @@ -149,7 +149,7 @@ export class AndroidDeviceManager { return; } const devices = data - .split('\n') + .split(/\r?\n/) .filter(notNull) .filter((l) => l !== ''); resolve(devices);