Skip to content

Commit 750de98

Browse files
authored
Merge pull request forcedotcom#156 from forcedotcom/resilient
chore: jump to the start of AVD definitions list
2 parents e5fa6f1 + 8fa9244 commit 750de98

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/common/device/AndroidDeviceManager.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,20 @@ export class AndroidDeviceManager {
228228
*/
229229
// eslint-disable-next-line class-methods-use-this
230230
private getAvdDefinitions(rawString: string): CaseInsensitiveStringMap[] {
231-
const input = rawString.replace(
232-
'\n\nThe following Android Virtual Devices could not be loaded:',
233-
'\n---------'
234-
);
231+
// While 'avdmanager list avd' may not have been able to parse some info about
232+
// some AVDs and may list those under the section marked as "could not load",
233+
// when we actually want to interact with those AVDs, most of the time ADB may
234+
// (and often actually can) interact with those AVDs. So even though avdmanager
235+
// lists these under the "could not load" section, we would still want to parse
236+
// the AVDs listed there and include them in our results.
237+
let input = rawString.replace('\n\nThe following Android Virtual Devices could not be loaded:', '\n---------');
238+
239+
// Find the location where the info about AVDs start
240+
const startIdx = input.indexOf('Available Android Virtual Devices');
241+
if (startIdx > 0) {
242+
input = input.substring(startIdx);
243+
}
244+
235245
const lines = input.trim().split('\n').slice(1); // skip the first line which is superficial line not containing any AVD data
236246
const separatorPattern = /^-+$/; // Regex to match separator lines with 2 or more dashes
237247
const chunks: string[] = []; // Array to hold the chunks

0 commit comments

Comments
 (0)