(rawOutput: string)
| 265 | }; |
| 266 | |
| 267 | function parseAndroidDeviceEntries(rawOutput: string): AndroidDeviceEntry[] { |
| 268 | const lines = rawOutput.split('\n').map((line) => line.trim()); |
| 269 | return lines |
| 270 | .filter((line) => line.length > 0 && !line.startsWith('List of devices')) |
| 271 | .map((line) => line.split(/\s+/)) |
| 272 | .flatMap((parts) => { |
| 273 | const serial = parts[0]; |
| 274 | if (serial === undefined || parts[1] !== 'device') return []; |
| 275 | return [ |
| 276 | { |
| 277 | serial, |
| 278 | rawModel: (parts.find((entry) => entry.startsWith('model:')) ?? '').replace('model:', ''), |
| 279 | }, |
| 280 | ]; |
| 281 | }); |
| 282 | } |
| 283 | |
| 284 | async function listAndroidDeviceEntries(): Promise<AndroidDeviceEntry[]> { |
| 285 | const result = await runCmd('adb', ['devices', '-l'], { |
no test coverage detected