@@ -339,7 +339,7 @@ Review licenses that have not been accepted (y/N)?
339
339
);
340
340
341
341
await licenseValidator.runLicenseManager ();
342
- expect (logger.errorText , contains (exceptionMessage));
342
+ expect (logger.traceText , contains (exceptionMessage));
343
343
expect (processManager, hasNoRemainingExpectations);
344
344
});
345
345
@@ -362,6 +362,42 @@ Review licenses that have not been accepted (y/N)?
362
362
expect (licenseValidator.runLicenseManager (), throwsToolExit ());
363
363
});
364
364
365
+ testWithoutContext ('runLicenseManager errors when sdkmanager exits non-zero' , () async {
366
+ const String sdkManagerPath = '/foo/bar/sdkmanager' ;
367
+ sdk.sdkManagerPath = sdkManagerPath;
368
+ final BufferLogger logger = BufferLogger .test ();
369
+ processManager.addCommand (
370
+ const FakeCommand (
371
+ command: < String > [sdkManagerPath, '--licenses' ],
372
+ exitCode: 1 ,
373
+ stderr: 'sdkmanager crash' ,
374
+ ),
375
+ );
376
+
377
+ final AndroidLicenseValidator licenseValidator = AndroidLicenseValidator (
378
+ androidSdk: sdk,
379
+ fileSystem: fileSystem,
380
+ processManager: processManager,
381
+ platform: FakePlatform (environment: < String , String > {'HOME' : '/home/me' }),
382
+ stdio: stdio,
383
+ logger: logger,
384
+ userMessages: UserMessages (),
385
+ androidStudio: FakeAndroidStudio (),
386
+ operatingSystemUtils: FakeOperatingSystemUtils (),
387
+ );
388
+
389
+ await expectLater (
390
+ licenseValidator.runLicenseManager (),
391
+ throwsToolExit (
392
+ message: 'Android sdkmanager tool was found, but failed to run ($sdkManagerPath ): "exited code 1"' ,
393
+ ),
394
+ );
395
+ expect (processManager, hasNoRemainingExpectations);
396
+ expect (logger.traceText, isEmpty);
397
+ expect (stdio.writtenToStdout, isEmpty);
398
+ expect (stdio.writtenToStderr, contains ('sdkmanager crash' ));
399
+ });
400
+
365
401
testWithoutContext ('detects license-only SDK installation with cmdline-tools' , () async {
366
402
sdk
367
403
..licensesAvailable = true
0 commit comments