Set the LANG when invoking cocoapods (#45710)
diff --git a/packages/flutter_tools/lib/src/macos/cocoapods.dart b/packages/flutter_tools/lib/src/macos/cocoapods.dart
index 3bfd940..8fb1dd6 100644
--- a/packages/flutter_tools/lib/src/macos/cocoapods.dart
+++ b/packages/flutter_tools/lib/src/macos/cocoapods.dart
@@ -77,7 +77,12 @@
processUtils.exitsHappy(<String>['which', 'pod']);
Future<String> get cocoaPodsVersionText {
- _versionText ??= processUtils.run(<String>['pod', '--version']).then<String>((RunResult result) {
+ _versionText ??= processUtils.run(
+ <String>['pod', '--version'],
+ environment: <String, String>{
+ 'LANG': 'en_US.UTF-8',
+ },
+ ).then<String>((RunResult result) {
return result.exitCode == 0 ? result.stdout.trim() : null;
}, onError: (dynamic _) => null);
return _versionText;
@@ -305,6 +310,7 @@
// See https://github.com/flutter/flutter/issues/10873.
// CocoaPods analytics adds a lot of latency.
'COCOAPODS_DISABLE_STATS': 'true',
+ 'LANG': 'en_US.UTF-8',
},
);
status.stop();
diff --git a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
index 44ee1b5..19ae134 100644
--- a/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
+++ b/packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart
@@ -80,12 +80,12 @@
when(mockProcessManager.run(
<String>['pod', 'install', '--verbose'],
workingDirectory: 'project/ios',
- environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'},
+ environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
)).thenAnswer((_) async => exitsHappy());
when(mockProcessManager.run(
<String>['pod', 'install', '--verbose'],
workingDirectory: 'project/macos',
- environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'},
+ environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
)).thenAnswer((_) async => exitsHappy());
});
@@ -368,6 +368,7 @@
environment: <String, String>{
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
'COCOAPODS_DISABLE_STATS': 'true',
+ 'LANG': 'en_US.UTF-8',
},
)).thenAnswer((_) async => exitsWithError(
'''
@@ -420,7 +421,7 @@
verify(mockProcessManager.run(
<String>['pod', 'install', '--verbose'],
workingDirectory: 'project/ios',
- environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true'},
+ environment: <String, String>{'FLUTTER_FRAMEWORK_DIR': 'engine/path', 'COCOAPODS_DISABLE_STATS': 'true', 'LANG': 'en_US.UTF-8'},
));
}, overrides: <Type, Generator>{
FileSystem: () => fs,
@@ -447,6 +448,7 @@
environment: <String, String>{
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
'COCOAPODS_DISABLE_STATS': 'true',
+ 'LANG': 'en_US.UTF-8',
},
));
}, overrides: <Type, Generator>{
@@ -477,6 +479,7 @@
environment: <String, String>{
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
'COCOAPODS_DISABLE_STATS': 'true',
+ 'LANG': 'en_US.UTF-8',
},
));
}, overrides: <Type, Generator>{
@@ -507,6 +510,7 @@
environment: <String, String>{
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
'COCOAPODS_DISABLE_STATS': 'true',
+ 'LANG': 'en_US.UTF-8',
},
));
}, overrides: <Type, Generator>{
@@ -539,6 +543,7 @@
environment: <String, String>{
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
'COCOAPODS_DISABLE_STATS': 'true',
+ 'LANG': 'en_US.UTF-8',
},
));
}, overrides: <Type, Generator>{
@@ -591,6 +596,7 @@
environment: <String, String>{
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
'COCOAPODS_DISABLE_STATS': 'true',
+ 'LANG': 'en_US.UTF-8',
},
)).thenAnswer(
(_) async => exitsWithError()
@@ -621,6 +627,7 @@
'FLUTTER_FRAMEWORK_DIR': 'engine/path',
'COCOAPODS_DISABLE_STATS': 'true',
'CP_REPOS_DIR': cocoapodsRepoDir,
+ 'LANG': 'en_US.UTF8',
};
});
@@ -629,7 +636,6 @@
fs.file(fs.path.join('project', 'ios', 'Podfile'))
..createSync()
..writeAsStringSync('Existing Podfile');
-
when(mockProcessManager.run(
<String>['pod', 'install', '--verbose'],
workingDirectory: 'project/ios',