From 9b69ca2e72f82d0860673b296b37026ad17fd3c4 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Tue, 25 Aug 2026 12:08:08 +0100 Subject: [PATCH 1/2] Fix "gclient sync" call in "dt serve" for Windows On Windows, shell scripts must be invoked with their ".bat" suffix. Without this fix, "gclient sync" would fail when called by "dt serve". --- tool/lib/model.dart | 11 +++++++---- tool/lib/utils.dart | 14 +++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tool/lib/model.dart b/tool/lib/model.dart index 12df45554aa..b31e4a14e80 100644 --- a/tool/lib/model.dart +++ b/tool/lib/model.dart @@ -5,6 +5,7 @@ import 'dart:io'; import 'package:collection/collection.dart'; +import 'package:devtools_tool/utils.dart'; import 'package:path/path.dart' as path; class DevToolsRepo { @@ -278,14 +279,16 @@ class FlutterSdk { final String sdkPath; - static String get flutterExecutableName => - Platform.isWindows ? 'flutter.bat' : 'flutter'; + /// The name of the 'flutter' shell script for the current platform. + static String get flutterExecutableName => shellScriptName('flutter'); + /// The name of the 'dart' wrapper shell script in Flutter for the current + /// platform. + /// /// On windows, 'dart' is fine for running the .exe from the Dart SDK directly /// but the wrapper in the Flutter bin folder is a .bat and needs an explicit /// extension. - static String get dartWrapperExecutableName => - Platform.isWindows ? 'dart.bat' : 'dart'; + static String get dartWrapperExecutableName => shellScriptName('dart'); String get flutterExePath => path.join(sdkPath, 'bin', flutterExecutableName); diff --git a/tool/lib/utils.dart b/tool/lib/utils.dart index 97e3b593e2b..b2cb4d98984 100644 --- a/tool/lib/utils.dart +++ b/tool/lib/utils.dart @@ -31,6 +31,14 @@ abstract class DartSdkHelper { } } +/// Returns the name of the shell script [name] for the current platform. +/// +/// On Windows, shell scripts have `.bat` extensions and must be invoked +/// using them them. +String shellScriptName(String name) { + return Platform.isWindows ? '$name.bat' : name; +} + String localDartSdkLocation() { final localDartSdkLocation = Platform.environment['LOCAL_DART_SDK']; if (localDartSdkLocation == null) { @@ -86,7 +94,11 @@ class CliCommand { List args, { bool throwOnException = true, }) { - return CliCommand('gclient', args, throwOnException: throwOnException); + return CliCommand( + shellScriptName('gclient'), + args, + throwOnException: throwOnException, + ); } factory CliCommand.tool(List args, {bool throwOnException = true}) { From 0510347d23fb224f846bfcd192299ec06a979fef Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Tue, 25 Aug 2026 12:08:58 +0100 Subject: [PATCH 2/2] Fix typo --- tool/lib/utils.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/lib/utils.dart b/tool/lib/utils.dart index b2cb4d98984..45ecdc8b280 100644 --- a/tool/lib/utils.dart +++ b/tool/lib/utils.dart @@ -34,7 +34,7 @@ abstract class DartSdkHelper { /// Returns the name of the shell script [name] for the current platform. /// /// On Windows, shell scripts have `.bat` extensions and must be invoked -/// using them them. +/// using them. String shellScriptName(String name) { return Platform.isWindows ? '$name.bat' : name; }