Repository navigation
For npm upgrade on Windows, go through cmd.exe to get path traversal working - #6387
Merged
Merged
Conversation
bolinfest
reviewed
Nov 8, 2025
bolinfest
self-requested a review
November 10, 2025 00:05
bolinfest
approved these changes
Nov 10, 2025
| let normalized_args: Vec<String> = args.iter().map(normalize_for_wsl).collect(); | ||
| // On Windows, run via cmd.exe so .CMD/.BAT are correctly resolved (PATHEXT semantics). | ||
| #[cfg(windows)] | ||
| let status = std::process::Command::new("cmd") |
Collaborator
There was a problem hiding this comment.
cmd.exe for good measure?
| use supports_color::Stream; | ||
|
|
||
| mod mcp_cmd; | ||
| #[cfg(not(windows))] |
Collaborator
There was a problem hiding this comment.
It's a bit surprising that WSL is needed when not(windows)...
| let command_path = crate::wsl_paths::normalize_for_wsl(cmd); | ||
| let normalized_args: Vec<String> = args | ||
| .iter() | ||
| .map(crate::wsl_paths::normalize_for_wsl) |
Collaborator
There was a problem hiding this comment.
This feels a bit wrong as none of the update args should be paths, correct?
Contributor
Author
There was a problem hiding this comment.
I'll let @dylan-hurd-oai comment on any/all WSL stuff
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
On Windows,
npmby itself does not resolve under std::process::Command which does not consider PATHEXT to resolve it tonpm.cmdin the PATH.By running the npm upgrade command via cmd.exe we get proper path semantics so it actually works.