Repository navigation
fix(upstream): run Windows cmd.exe-wrapped commands with spaces in paths - #1963
Merged
Dumbris merged 3 commits intoNov 24, 2026
Merged
Conversation
On Windows, WrapWithUserShell returns ["/c", commandString] for cmd.exe. Go quotes that single argument and escapes its embedded quotes as \", which cmd.exe does not understand, so any quoted command path or argument (e.g. under "Program Files" or "HTTP Toolkit") failed to start. Add shellwrap.UseVerbatimCmdLine, which sets SysProcAttr.CmdLine to `cmd.exe /s /c "<commandString>"` for a cmd.exe /c invocation so the string reaches cmd.exe as built, and call it at the three spawn sites that run a shell-wrapped command (stdio transport, launcher, docker fallback). No-op on other platforms and for any other command. Fixes smart-mcp-proxy#1960
…mand line Guards the smart-mcp-proxy#1960 fix at the stdio and launcher spawn paths, so a refactor that drops the UseVerbatimCmdLine call fails a test.
felipecrs
added a commit
to felipecrs/mcpproxy-go
that referenced
this pull request
Nov 20, 2026
…ths (smart-mcp-proxy#1963) Squash of upstream PR smart-mcp-proxy#1963 (not yet merged upstream).
felipecrs
added a commit
to felipecrs/mcpproxy-go
that referenced
this pull request
Nov 21, 2026
…ths (smart-mcp-proxy#1963) Squash of upstream PR smart-mcp-proxy#1963 (not yet merged upstream).
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Codecov on smart-mcp-proxy#1963 reported two uncovered lines: the !windows no-op in internal/shellwrap/cmdline_other.go and the shell-wrap fallback in newDockerCmd (internal/upstream/core/docker.go). Add a !windows test for the no-op and a cross-platform test that forces the newDockerCmd fallback with docker genuinely absent.
felipecrs
added a commit
to felipecrs/mcpproxy-go
that referenced
this pull request
Nov 23, 2026
…ths (smart-mcp-proxy#1963) Squash of upstream PR smart-mcp-proxy#1963 (not yet merged upstream).
Dumbris
enabled auto-merge (squash)
November 24, 2026 11:24
Member
|
Merged — thanks @felipecrs. This fixes #1960 on both the direct and the Docker fallback path, which is why we went with it over #1980. It ships in the next release. You have landed several fixes this week (#1961 and this one, with #1962 and #1972 close behind). If you ever feel like mentioning mcpproxy where you talk about your setup, we would appreciate it — entirely optional. |
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.
Pull Request
Description
Fixes #1960. On Windows, a stdio upstream whose command path (or any argument) contains a space never starts.
Cause: for cmd.exe,
shellwrap.WrapWithUserShellreturns["/c", commandString], wherecommandStringalready has cmd.exe quoting ("C:/.../HTTP Toolkit/x.cmd" arg).exec.Cmdquotes that single argument and escapes the embedded quotes as\". cmd.exe doesn't treat\"as an escape, so it looks for a program literally named\"C:/...cmd\".Fix: a new
shellwrap.UseVerbatimCmdLine(cmd)setsSysProcAttr.CmdLinetocmd.exe /s /c "<commandString>"when the command iscmd.exe /c <string>, so cmd.exe gets the string as built./smakes cmd.exe strip only the outer quotes. It does nothing on other platforms and for any other command. It runs at the three places that start a shell-wrapped process:process_windows.go: the stdio transportCommandFuncconnection_launcher.go:buildLauncherCmddocker.go: the login-shell fallback innewDockerCmdWrapWithUserShell's return shape is unchanged, because the cidfile insertion helpers and the existing tests rely on["/c", str].Testing
TestUseVerbatimCmdLine_PathWithSpace(Windows only) runs a real.cmdfile from aHTTP Toolkitdirectory with an argument containing a space. Without the helper it fails with the error from the issue; with it, it passes. Theinternal/upstream/...andinternal/shellwraptests pass on Windows, andgo vetis clean for windows, linux and darwin on the changed packages. golangci-lint wasn't run locally.TestResolveDockerSpawnHonorsConfiguredAbsoluteDockerfails locally whenSHELLpoints at Git Bash (it expects backslash paths). That happens with or without this change, and the test passes withSHELLunset.