From 171ba00b587dd65a33bd5b1cc7b740ac2e0ded43 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Sat, 1 Mar 2025 00:27:25 +0000 Subject: [PATCH] In update_engine_version_test.dart, do not populate the test environment with the host platform environment (#164395) --- dev/tools/test/update_engine_version_test.dart | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dev/tools/test/update_engine_version_test.dart b/dev/tools/test/update_engine_version_test.dart index ca5c6114d6..f938a01f8b 100644 --- a/dev/tools/test/update_engine_version_test.dart +++ b/dev/tools/test/update_engine_version_test.dart @@ -77,8 +77,17 @@ void main() { ); environment = {}; - 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 powerShellVariables = ['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. flutterRoot.binInternalUpdateEngineVersion.copySyncRecursive( @@ -171,6 +180,8 @@ void main() { } run('git', ['init', '--initial-branch', 'master']); + run('git', ['config', '--local', 'user.email', 'test@example.com']); + run('git', ['config', '--local', 'user.name', 'Test User']); run('git', ['add', '.']); run('git', ['commit', '-m', 'Initial commit']); if (branch != 'master') {