diff --git a/pkgs/dart_mcp/CHANGELOG.md b/pkgs/dart_mcp/CHANGELOG.md index e85f132..6b84acc 100644 --- a/pkgs/dart_mcp/CHANGELOG.md +++ b/pkgs/dart_mcp/CHANGELOG.md @@ -8,6 +8,7 @@ - The old `reject` enum value was replaced with a static constant equal exactly to `decline`, so switches are not affected. - Add `title` parameter to `Prompt` constructor. +- Only execute sub-processes in a shell if they are `.bat` files. ## 0.3.2 diff --git a/pkgs/dart_mcp_server/lib/src/utils/cli_utils.dart b/pkgs/dart_mcp_server/lib/src/utils/cli_utils.dart index 524f0e3..9b595e3 100644 --- a/pkgs/dart_mcp_server/lib/src/utils/cli_utils.dart +++ b/pkgs/dart_mcp_server/lib/src/utils/cli_utils.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; +import 'dart:io' as io; import 'package:collection/collection.dart'; import 'package:dart_mcp/server.dart'; @@ -224,7 +225,10 @@ Future runCommandInRoot( final result = await processManager.run( commandWithPaths, workingDirectory: workingDir.path, - runInShell: true, + runInShell: + // Required when running .bat files on windows, but otherwise should + // be avoided due to escaping behavior. + io.Platform.isWindows && commandWithPaths.first.endsWith('.bat'), ); final output = (result.stdout as String).trim();