From 27f045a4123bccd1f841b718497ea6ae645ed17b Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Wed, 3 Jun 2026 05:29:31 -0700 Subject: [PATCH] uninstall.ps1: exit 0 on success (do not leak WSL probe exit code) The WSL distro-probe loop tries a candidate list that intentionally includes distros that may not exist; the last failed `wsl -d -- true` probe left $LASTEXITCODE=255, so `& .\uninstall.ps1` returned non-zero even when every cleanup step succeeded. Reset $global:LASTEXITCODE=0 at the end (not `exit 0`, so the `irm ... | iex` usage does not kill the caller shell). Co-Authored-By: Claude Opus 4.8 --- scripts/uninstall.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/uninstall.ps1 b/scripts/uninstall.ps1 index 5dc4052db9..51d13b2c3d 100644 --- a/scripts/uninstall.ps1 +++ b/scripts/uninstall.ps1 @@ -414,6 +414,15 @@ function Uninstall-UnslothStudio { Write-Host "set to also remove that install tree, e.g.:" Write-Host " `$env:UNSLOTH_STUDIO_HOME = 'C:\your\path'; irm https://raw.githubusercontent.com/unslothai/unsloth/main/scripts/uninstall.ps1 | iex" } + + # A successful uninstall must report success. The WSL distro-probe loop above + # leaves $LASTEXITCODE set by the last `wsl -d -- true` probe, and the + # candidate list intentionally includes distros that may not exist (their + # probes fail by design) -- so without this reset `& .\uninstall.ps1` would + # exit non-zero (255) even though every cleanup step succeeded. Set the var + # rather than calling `exit 0` so the `irm ... | iex` usage does not terminate + # the caller's shell. + $global:LASTEXITCODE = 0 } Uninstall-UnslothStudio @args