In update_engine_version_test.dart, do not populate the test environment with the host platform environment (#164395)

This commit is contained in:
Jason Simmons 2025-03-01 00:27:25 +00:00 committed by GitHub
parent d859e2f43e
commit 171ba00b58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -77,8 +77,17 @@ void main() {
); );
environment = <String, String>{}; environment = <String, String>{};
environment.addAll(io.Platform.environment);
environment.remove('FLUTTER_PREBUILT_ENGINE_VERSION'); if (const LocalPlatform().isWindows) {
// Copy a minimal set of environment variables needed to run the update_engine_version script in PowerShell.
const List<String> powerShellVariables = <String>['SystemRoot', 'Path', 'PATHEXT'];
for (final String key in powerShellVariables) {
final String? value = io.Platform.environment[key];
if (value != null) {
environment[key] = value;
}
}
}
// Copy the update_engine_version script and create a rough directory structure. // Copy the update_engine_version script and create a rough directory structure.
flutterRoot.binInternalUpdateEngineVersion.copySyncRecursive( flutterRoot.binInternalUpdateEngineVersion.copySyncRecursive(
@ -171,6 +180,8 @@ void main() {
} }
run('git', <String>['init', '--initial-branch', 'master']); run('git', <String>['init', '--initial-branch', 'master']);
run('git', <String>['config', '--local', 'user.email', 'test@example.com']);
run('git', <String>['config', '--local', 'user.name', 'Test User']);
run('git', <String>['add', '.']); run('git', <String>['add', '.']);
run('git', <String>['commit', '-m', 'Initial commit']); run('git', <String>['commit', '-m', 'Initial commit']);
if (branch != 'master') { if (branch != 'master') {