Unverified Commit 5de5bb01 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

fix platform environment (#40692)

parent 9a68b0df
...@@ -131,7 +131,7 @@ class UpgradeCommandRunner { ...@@ -131,7 +131,7 @@ class UpgradeCommandRunner {
], ],
workingDirectory: Cache.flutterRoot, workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true, allowReentrantFlutter: true,
environment: platform.environment, environment: Map<String, String>.of(platform.environment),
); );
if (code != 0) { if (code != 0) {
throwToolExit(null, exitCode: code); throwToolExit(null, exitCode: code);
...@@ -250,7 +250,7 @@ class UpgradeCommandRunner { ...@@ -250,7 +250,7 @@ class UpgradeCommandRunner {
], ],
workingDirectory: Cache.flutterRoot, workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true, allowReentrantFlutter: true,
environment: platform.environment, environment: Map<String, String>.of(platform.environment),
); );
if (code != 0) { if (code != 0) {
throwToolExit(null, exitCode: code); throwToolExit(null, exitCode: code);
......
...@@ -46,10 +46,10 @@ void main() { ...@@ -46,10 +46,10 @@ void main() {
return Future<Process>.value(createMockProcess()); return Future<Process>.value(createMockProcess());
}); });
fakeCommandRunner.willHaveUncomittedChanges = false; fakeCommandRunner.willHaveUncomittedChanges = false;
fakePlatform = FakePlatform()..environment = <String, String>{ fakePlatform = FakePlatform()..environment = Map<String, String>.unmodifiable(<String, String>{
'ENV1': 'irrelevant', 'ENV1': 'irrelevant',
'ENV2': 'irrelevant', 'ENV2': 'irrelevant',
}; });
}); });
testUsingContext('throws on unknown tag, official branch, noforce', () async { testUsingContext('throws on unknown tag, official branch, noforce', () async {
...@@ -147,7 +147,8 @@ void main() { ...@@ -147,7 +147,8 @@ void main() {
workingDirectory: anyNamed('workingDirectory'), workingDirectory: anyNamed('workingDirectory'),
)); ));
expect(result.captured.first, fakePlatform.environment); expect(result.captured.first,
<String, String>{ 'FLUTTER_ALREADY_LOCKED': 'true', ...fakePlatform.environment });
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
Platform: () => fakePlatform, Platform: () => fakePlatform,
...@@ -177,7 +178,8 @@ void main() { ...@@ -177,7 +178,8 @@ void main() {
workingDirectory: anyNamed('workingDirectory'), workingDirectory: anyNamed('workingDirectory'),
)); ));
expect(result.captured.first, fakePlatform.environment); expect(result.captured.first,
<String, String>{ 'FLUTTER_ALREADY_LOCKED': 'true', ...fakePlatform.environment });
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
ProcessManager: () => processManager, ProcessManager: () => processManager,
Platform: () => fakePlatform, Platform: () => fakePlatform,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment