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 <name> -- 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 <noreply@anthropic.com>
This commit is contained in:
parent
962ab23317
commit
27f045a412
1 changed files with 9 additions and 0 deletions
|
|
@ -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 <name> -- 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue