mirror of
https://github.com/unslothai/unsloth.git
synced 2026-05-20 00:51:36 +00:00
install.ps1: use 'return' over 'exit 1' for Install-UnslothStudio bail-outs
Per Gemini review #4177659001: when users run install.ps1 via 'irm ... | iex', 'exit 1' inside the function terminates the entire PowerShell process and closes the user's terminal. 'return' bails out of the function while keeping the shell open, matching existing error sites at lines 34, 50, 57. Three sites fixed: --tauri+env-override guard, env-override mkdir/access failure, and write-probe failure. The 'exit' calls at lines 591/611 are inside a generated launcher here-string (a separate top-level .ps1 that runs as its own process), so they correctly stay as 'exit'.
This commit is contained in:
parent
b7fa2c8718
commit
393e676b04
1 changed files with 3 additions and 3 deletions
|
|
@ -96,7 +96,7 @@ function Install-UnslothStudio {
|
|||
Write-Host " The desktop app still uses the legacy %USERPROFILE%\.unsloth\studio root." -ForegroundColor Red
|
||||
Write-Host " Run install.ps1 without --tauri for custom-root shell installs," -ForegroundColor Yellow
|
||||
Write-Host " or unset the env var for default desktop installs." -ForegroundColor Yellow
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ function Install-UnslothStudio {
|
|||
$StudioHome = (Resolve-Path -LiteralPath $envOverride).Path
|
||||
} catch {
|
||||
Write-Host "ERROR: STUDIO_HOME=$envOverride cannot be created or accessed." -ForegroundColor Red
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
$probe = Join-Path $StudioHome (".unsloth-write-probe-" + [guid]::NewGuid())
|
||||
try {
|
||||
|
|
@ -130,7 +130,7 @@ function Install-UnslothStudio {
|
|||
Remove-Item -LiteralPath $probe -Force -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
Write-Host "ERROR: STUDIO_HOME=$StudioHome is not writable." -ForegroundColor Red
|
||||
exit 1
|
||||
return
|
||||
}
|
||||
$StudioDataDir = Join-Path $StudioHome "share"
|
||||
$StudioRedirectMode = 'env'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue