Skip to content

Fix: Fail and warn the user when --uninstall is given parameters#14524

Merged
chemwolf6922 merged 4 commits intomasterfrom
user/chemwolf6922/fail-and-warn-user-when-uninstall-is-followed-by-a-parameter
Mar 25, 2026
Merged

Fix: Fail and warn the user when --uninstall is given parameters#14524
chemwolf6922 merged 4 commits intomasterfrom
user/chemwolf6922/fail-and-warn-user-when-uninstall-is-followed-by-a-parameter

Conversation

@chemwolf6922
Copy link
Contributor

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

  • Tested on my local system with wsl --uninstall Ubuntu
  • Tested with the newly added unit test.

@chemwolf6922 chemwolf6922 requested a review from a team as a code owner March 25, 2026 02:17
@chemwolf6922 chemwolf6922 changed the title User/chemwolf6922/fail and warn user when uninstall is followed by a parameter Fix: Fail and warn the user when --uninstall is given parameters Mar 25, 2026
@chemwolf6922
Copy link
Contributor Author

Recreating #14507 as the original PR is stuck on github.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates wsl.exe argument parsing to prevent accidental full WSL uninstalls when users mistakenly pass a distro name to --uninstall (a common confusion with --unregister).

Changes:

  • Rejects any extra arguments after --uninstall and prints a localized guidance message pointing users to --unregister.
  • Adds a unit test validating the new rejection behavior and exit code.
  • Introduces a new localized string for the user-facing message.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/windows/common/WslClient.cpp Adds validation to fail fast if --uninstall is followed by any additional token(s).
test/windows/UnitTests.cpp Adds a unit test asserting the new output and -1 exit code for --uninstall <arg>.
localization/strings/en-US/Resources.resw Adds the new localized message string used by the CLI.

@chemwolf6922 chemwolf6922 merged commit 83d59d4 into master Mar 25, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants