Don't crash when ADB exits with non-zero exit code (#9653)
This commit is contained in:
committed by
GitHub
parent
36052e68dd
commit
b432af51fd
@@ -238,14 +238,20 @@ class AndroidDevice extends Device {
|
||||
return false;
|
||||
|
||||
final Status status = logger.startProgress('Installing ${apk.apkPath}...', expectSlowOperation: true);
|
||||
final RunResult installResult = await runCheckedAsync(adbCommandForDevice(<String>['install', '-r', apk.apkPath]));
|
||||
final RunResult installResult = await runAsync(adbCommandForDevice(<String>['install', '-r', apk.apkPath]));
|
||||
status.stop();
|
||||
// Some versions of adb exit with exit code 0 even on failure :(
|
||||
// Parsing the output to check for failures.
|
||||
final RegExp failureExp = new RegExp(r'^Failure.*$', multiLine: true);
|
||||
final String failure = failureExp.stringMatch(installResult.stdout);
|
||||
if (failure != null) {
|
||||
printError('Package install error: $failure');
|
||||
return false;
|
||||
}
|
||||
if (installResult.exitCode != 0) {
|
||||
printError('Error: ADB exited with exit code ${installResult.exitCode}');
|
||||
return false;
|
||||
}
|
||||
|
||||
await runCheckedAsync(adbCommandForDevice(<String>[
|
||||
'shell', 'echo', '-n', _getSourceSha1(app), '>', _getDeviceSha1Path(app)
|
||||
|
||||
Reference in New Issue
Block a user