Fix: Fail and warn the user when --uninstall is given parameters#14507
Open
chemwolf6922 wants to merge 3 commits intomasterfrom
Open
Fix: Fail and warn the user when --uninstall is given parameters#14507chemwolf6922 wants to merge 3 commits intomasterfrom
chemwolf6922 wants to merge 3 commits intomasterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves wsl.exe CLI UX by rejecting --uninstall when users pass extra parameters (commonly a distro name), and guiding them toward --unregister instead—preventing accidental misuse.
Changes:
- Updated
wsl.exeargument parsing to detect and reject any extra tokens after--uninstall. - Added a unit test validating the new behavior and exit code.
- Added localized
MessageUninstallNoArgumentsstring across all shipped locales.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/windows/common/WslClient.cpp |
Rejects --uninstall when followed by any argument and prints a localized guidance message. |
test/windows/UnitTests.cpp |
Adds a regression test asserting message + -1 exit code for --uninstall <arg>. |
localization/strings/*/Resources.resw |
Adds MessageUninstallNoArguments across all locales to keep localization complete. |
benhillis
reviewed
Mar 23, 2026
| <value>Aktualizace se nezdařila (ukončovací kód: {}).</value> | ||
| <comment>{FixedPlaceholder="{}"}Command line arguments, file names and string inserts should not be translated</comment> | ||
| </data> | ||
| <data name="MessageUninstallNoArguments" xml:space="preserve"> |
Member
There was a problem hiding this comment.
How did you generate these localization files? You only need to modify en-US and the rest are auto-generated.
benhillis
requested changes
Mar 23, 2026
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 of the Pull Request
Fail and warn the user when --uninstall is given parameters. The user is likely misusing the command to uninstall the distro instead of uninstall WSL.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
wsl --uninstall Ubuntu