fix: Allow pnpm execution without .cmd extension on Windows in SpaProxy#65386
Open
murataslan1 wants to merge 1 commit intodotnet:mainfrom
Open
fix: Allow pnpm execution without .cmd extension on Windows in SpaProxy#65386murataslan1 wants to merge 1 commit intodotnet:mainfrom
murataslan1 wants to merge 1 commit intodotnet:mainfrom
Conversation
…n SpaProxy Previously, SpaProxyLaunchManager blindly appended .cmd extension to any command without an extension on Windows. This caused issues for tools installed as standalone executables (like pnpm.exe). This change restricts the forced .cmd extension behavior to only 'npm' and 'yarn', allowing 'pnpm' and other tools to be resolved correctly by the shell. Fixes dotnet#45700
Contributor
|
Thanks for your PR, @@murataslan1. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates SpaProxy’s Windows command resolution so that SpaProxyLaunchCommand can run standalone executables like pnpm.exe without SpaProxy incorrectly forcing a .cmd extension.
Changes:
- On Windows, append
.cmdonly when the launch tool isnpmoryarn(case-insensitive). - Preserve existing override behavior when the user explicitly provides an extension (via
Path.HasExtension(command)).
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.
Description
This PR addresses issue #45700 by modifying
SpaProxyLaunchManagerto avoid blindly appending the.cmdextension to the launch command on Windows if it is notnpmoryarn.Problem
Previously, any launch command without an extension on Windows would have
.cmdappended to it. This prevented tools installed as standalone executables (such aspnpm.exe) from being launched correctly, as the system would look forpnpm.cmdwhich might not exist or be the intended target.Solution
The logic has been updated to only append
.cmdfornpmandyarncommands (maintaining backward compatibility and typical Windows behavior for these tools). For other commands, such aspnpm, the extension is not forced, allowingProcess.StartwithUseShellExecute = trueto resolve the executable fromPATHcorrectly (finding.exe,.cmd,.bat, etc.).Fixes #45700