[flutter_tools] print override storage warning to STDERR instead of STDOUT (#106068)

This commit is contained in:
Christopher Fujino 2022-06-15 16:22:06 -07:00 committed by GitHub
parent 261246b820
commit 589dd8028b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -520,7 +520,7 @@ class Cache {
if (_hasWarnedAboutStorageOverride) {
return;
}
_logger.printStatus(
_logger.printError(
'Flutter assets will be downloaded from $overrideUrl. Make sure you trust this source!',
emphasis: true,
);

View File

@ -319,6 +319,22 @@ void main() {
expect(() => cache.storageBaseUrl, throwsToolExit());
});
testWithoutContext('overridden storage base url prints warning to STDERR', () async {
final BufferLogger logger = BufferLogger.test();
const String baseUrl = 'https://storage.com';
final Cache cache = Cache.test(
platform: FakePlatform(environment: <String, String>{
'FLUTTER_STORAGE_BASE_URL': baseUrl,
}),
processManager: FakeProcessManager.any(),
logger: logger,
);
expect(cache.storageBaseUrl, baseUrl);
expect(logger.errorText, contains('Flutter assets will be downloaded from $baseUrl'));
expect(logger.statusText, isEmpty);
});
});
testWithoutContext('flattenNameSubdirs', () {