Repository navigation
Fix: Fail and warn the user when --uninstall is given parameters - #14507
Closed
Feng Wang (chemwolf6922) wants to merge 3 commits into
Closed
Feng Wang (chemwolf6922) wants to merge 3 commits into
Feng Wang (chemwolf6922) wants to merge 3 commits into
Conversation
Feng Wang (chemwolf6922)
requested review from
Brian Perkins (Brian-Perkins),
Blue (OneBlue),
Ben Hillis (benhillis),
Copilot and
John Starks (jstarks)
March 23, 2026 09:21
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. |
Ben Hillis (benhillis)
requested changes
Mar 23, 2026
Contributor
Author
Contributor
Author
|
Closing this one as github is stuck. |
3 of 6 tasks
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