Skip to content

Commit

Permalink
include exception details in tool exit displayed when adb call fails (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkolos committed Apr 30, 2024
1 parent af27093 commit ce822ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class AndroidDevices extends PollingDeviceDiscovery {
} on ProcessException catch (exception) {
throwToolExit(
'Unable to run "adb", check your Android SDK installation and '
'$kAndroidHome environment variable: ${exception.executable}',
'$kAndroidHome environment variable: ${exception.executable}\n'
'Error details: ${exception.message}',
);
}
final List<AndroidDevice> devices = <AndroidDevice>[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void main() {
const FakeCommand(
command: <String>['adb', 'devices', '-l'],
exitCode: 1,
stderr: '<stderr from adb>'
),
]);
final AndroidDevices androidDevices = AndroidDevices(
Expand All @@ -99,8 +100,15 @@ void main() {
userMessages: UserMessages(),
);

expect(androidDevices.pollingGetDevices(),
throwsToolExit(message: RegExp('Unable to run "adb"')));
expect(
androidDevices.pollingGetDevices(),
throwsToolExit(
message:
'Unable to run "adb", check your Android SDK installation and ANDROID_HOME environment variable: adb\n'
'Error details: Process exited abnormally with exit code 1:\n'
'<stderr from adb>',
),
);
});

testWithoutContext('AndroidDevices is disabled if feature is disabled', () {
Expand Down

0 comments on commit ce822ec

Please sign in to comment.