fix platform environment (#40692)

This commit is contained in:
Jonah Williams
2019-09-17 17:07:55 -07:00
committed by GitHub
parent 9a68b0df3e
commit 5de5bb0172
2 changed files with 8 additions and 6 deletions

View File

@@ -131,7 +131,7 @@ class UpgradeCommandRunner {
],
workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true,
environment: platform.environment,
environment: Map<String, String>.of(platform.environment),
);
if (code != 0) {
throwToolExit(null, exitCode: code);
@@ -250,7 +250,7 @@ class UpgradeCommandRunner {
],
workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true,
environment: platform.environment,
environment: Map<String, String>.of(platform.environment),
);
if (code != 0) {
throwToolExit(null, exitCode: code);

View File

@@ -46,10 +46,10 @@ void main() {
return Future<Process>.value(createMockProcess());
});
fakeCommandRunner.willHaveUncomittedChanges = false;
fakePlatform = FakePlatform()..environment = <String, String>{
fakePlatform = FakePlatform()..environment = Map<String, String>.unmodifiable(<String, String>{
'ENV1': 'irrelevant',
'ENV2': 'irrelevant',
};
});
});
testUsingContext('throws on unknown tag, official branch, noforce', () async {
@@ -147,7 +147,8 @@ void main() {
workingDirectory: anyNamed('workingDirectory'),
));
expect(result.captured.first, fakePlatform.environment);
expect(result.captured.first,
<String, String>{ 'FLUTTER_ALREADY_LOCKED': 'true', ...fakePlatform.environment });
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
Platform: () => fakePlatform,
@@ -177,7 +178,8 @@ void main() {
workingDirectory: anyNamed('workingDirectory'),
));
expect(result.captured.first, fakePlatform.environment);
expect(result.captured.first,
<String, String>{ 'FLUTTER_ALREADY_LOCKED': 'true', ...fakePlatform.environment });
}, overrides: <Type, Generator>{
ProcessManager: () => processManager,
Platform: () => fakePlatform,