Commit 9c1aba2a authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Skip adb server restarts during device discovery (#9693)

parent c6b0f833
......@@ -64,12 +64,14 @@ class AndroidDevice extends Device {
// `adb shell getprop` result as UTF8.
final ProcessResult result = await processManager.run(
propCommand,
stdoutEncoding: LATIN1
stdoutEncoding: LATIN1,
stderrEncoding: LATIN1,
).timeout(const Duration(seconds: 5));
if (result.exitCode == 0) {
_properties = parseAdbDeviceProperties(result.stdout);
} else {
printError('Error retrieving device properties for $name.');
printError('Error retrieving device properties for $name:');
printError(result.stderr);
}
} on TimeoutException catch (_) {
throwToolExit('adb not responding');
......@@ -515,6 +517,7 @@ List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) {
if (mockAdbOutput == null) {
final String adbPath = getAdbPath(androidSdk);
printTrace('Listing devices using $adbPath');
if (adbPath == null)
return <AndroidDevice>[];
text = runSync(<String>[adbPath, 'devices', '-l']);
......@@ -533,6 +536,12 @@ List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) {
if (line.startsWith('* daemon '))
continue;
// Skip lines about adb server and client version not matching
if (line.startsWith('adb server version')) {
printStatus(line);
continue;
}
if (line.startsWith('List of devices'))
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment