From 393e676b044e4e84ffeec9eee857b089ccd2d7fc Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 27 Apr 2026 00:13:29 +0000 Subject: [PATCH] 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'. --- install.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.ps1 b/install.ps1 index 8d8338aee..f6d95029d 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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'