allow adb to set canfail then use canFail=true for clearing logs (#150517)
Fixes https://github.com/flutter/flutter/issues/150093 New tests added to cover that we at least pass the arguments we expect to adb. The test for #150093 is not ideal in that it does not verify the behavior of a failed process but instead ensures we set the parameter that contains the behavior we want. devicelab code and tests are not setup to enable fake process or fake output from stdin/stderr and hang if adb or no hardware are present.
This commit is contained in:
@@ -706,6 +706,7 @@ class AndroidDevice extends Device {
|
||||
List<String> arguments, {
|
||||
Map<String, String>? environment,
|
||||
bool silent = false,
|
||||
bool canFail = false, // as in, whether failures are ok. False means that they are fatal.
|
||||
}) {
|
||||
return eval(
|
||||
adbPath,
|
||||
@@ -713,6 +714,7 @@ class AndroidDevice extends Device {
|
||||
environment: environment,
|
||||
printStdout: !silent,
|
||||
printStderr: !silent,
|
||||
canFail: canFail,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -735,7 +737,7 @@ class AndroidDevice extends Device {
|
||||
@override
|
||||
Future<void> startLoggingToSink(IOSink sink, {bool clear = true}) async {
|
||||
if (clear) {
|
||||
await adb(<String>['logcat', '--clear'], silent: true);
|
||||
await adb(<String>['logcat', '--clear'], silent: true, canFail: true);
|
||||
}
|
||||
_loggingProcess = await startProcess(
|
||||
adbPath,
|
||||
@@ -770,7 +772,7 @@ class AndroidDevice extends Device {
|
||||
|
||||
@override
|
||||
Future<void> clearLogs() {
|
||||
return adb(<String>['logcat', '-c']);
|
||||
return adb(<String>['logcat', '-c'], canFail: true);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user