Repository navigation
fix(shellwrap): convert backslash Windows paths for Git Bash (finish or take over PR #1319) - #1493
Merged
Merged
Conversation
WrapWithUserShell correctly single-quotes a backslash-style Windows path (e.g. C:\ProgramData\foo\bar.cmd) when the resolved login shell is bash-like, but Git Bash / MSYS still cannot execute it: MSYS's own exec layer only resolves POSIX-style paths. A backslash path falls through to bash's PATH lookup, which fails with "command not found" and mangles the path in its own error rendering (backslashes silently dropped). This breaks every stdio server configured with an absolute Windows-path command (wrapper .cmd/.bat scripts are the common case) on any Windows host where the resolved shell is bash-like, e.g. Git Bash / VS Code integrated terminal / MSYS2 set as $SHELL. Fix: convert backslashes to forward slashes in the command and args before shell-escaping, but only on the Windows + bash-like-shell branch. Windows' CreateProcess and MSYS's exec layer both accept forward-slash paths, so this is safe in both directions. Verified against a real config with 14 wrapper-.cmd-based stdio servers that were all failing with this exact error: connected server count went from 13 to 27, tool count from 249 to 403, after rebuilding with this fix. Fixes #1318
Deploying mcpproxy-docs with
|
| Latest commit: |
fdb05a8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a8422c13.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-issues-b1-backend-shellw.mcpproxy-docs.pages.dev |
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 37300187772 --repo smart-mcp-proxy/mcpproxy-go
|
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix stdio servers on Windows with Git Bash or MSYS shells failing to execute commands due to backslash-style path handling. Converted paths use forward slashes which are accepted by both Windows CreateProcess and MSYS's exec layer.
Windows: Git Bash cannot exec backslash-style Windows paths, breaks every wrapper-script stdio server #1318 — Git Bash stdio command execution: Convert backslash paths to forward slashes when wrapping commands for bash-like shells on Windows. Fixed verified against 14 real wrapper-.cmd-based servers: connected server count went from 13 to 27, tool count 249 to 403. Tests: unit tests for path conversion logic, real Git Bash exec check.
Path conversion scoping: Refined to convert only path-like arguments (drive-letter and UNC paths), leaving regex patterns, domain\user values and other backslash strings untouched. Tests: comprehensive cases covering .cmd commands, paths with spaces, script args, regex args, domain\user, UNC paths, and cmd.exe behavior.
Cross-platform test injection: Injected GOOS into tests so Windows code paths can be verified on any host (Linux/macOS) without running the full integration. Tests: stubWindows() helper, non-Windows preservation test.
Closes #1318