Skip to content

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

Open
chemwolf6922 wants to merge 3 commits intomasterfrom
user/chemwolf6922/fail-and-warn-user-when-uninstall-is-followed-by-a-parameter
Open

Fix: Fail and warn the user when --uninstall is given parameters#14507
chemwolf6922 wants to merge 3 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.

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 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.exe argument parsing to detect and reject any extra tokens after --uninstall.
  • Added a unit test validating the new behavior and exit code.
  • Added localized MessageUninstallNoArguments string 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.

@chemwolf6922 chemwolf6922 changed the title Fail and warn the user when --uninstall is given parameters Fix: Fail and warn the user when --uninstall is given parameters 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">
Copy link
Member

Choose a reason for hiding this comment

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

How did you generate these localization files? You only need to modify en-US and the rest are auto-generated.

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