Minor fixes in tools: (#11009)
* Include the process' `stdout` and `stderr` when it returns a non-zero exit code in `runCheckedAsync()` * Defensively catch errors in `AndroidDevice.isAppInstalled()` and return false
This commit is contained in:
@@ -243,8 +243,13 @@ class AndroidDevice extends Device {
|
||||
@override
|
||||
Future<bool> isAppInstalled(ApplicationPackage app) async {
|
||||
// This call takes 400ms - 600ms.
|
||||
final RunResult listOut = await runCheckedAsync(adbCommandForDevice(<String>['shell', 'pm', 'list', 'packages', app.id]));
|
||||
return LineSplitter.split(listOut.stdout).contains("package:${app.id}");
|
||||
try {
|
||||
final RunResult listOut = await runCheckedAsync(adbCommandForDevice(<String>['shell', 'pm', 'list', 'packages', app.id]));
|
||||
return LineSplitter.split(listOut.stdout).contains('package:${app.id}');
|
||||
} catch (error) {
|
||||
printTrace('$error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -211,7 +211,7 @@ Future<RunResult> runCheckedAsync(List<String> cmd, {
|
||||
environment: environment
|
||||
);
|
||||
if (result.exitCode != 0)
|
||||
throw 'Exit code ${result.exitCode} from: ${cmd.join(' ')}';
|
||||
throw 'Exit code ${result.exitCode} from: ${cmd.join(' ')}:\n$result';
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user