From 676a5069019fe45e10bf6d9614d9768a03e990b9 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Sat, 14 Mar 2026 19:58:09 +0000 Subject: [PATCH] setup.ps1: validate Python probe exit code before persisting Scripts PATH --- studio/setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/setup.ps1 b/studio/setup.ps1 index 76254df294..1cf17b5d27 100644 --- a/studio/setup.ps1 +++ b/studio/setup.ps1 @@ -596,7 +596,7 @@ if ($HasPython) { # Ensure Python Scripts dir is on PATH (so 'unsloth' command works in new terminals) $ScriptsDir = python -c "import sysconfig; print(sysconfig.get_path('scripts', 'nt_user') if __import__('os').path.exists(sysconfig.get_path('scripts', 'nt_user')) else sysconfig.get_path('scripts'))" -if ($ScriptsDir) { +if ($LASTEXITCODE -eq 0 -and $ScriptsDir -and (Test-Path $ScriptsDir)) { $UserPath = [Environment]::GetEnvironmentVariable('Path', 'User') $UserPathEntries = if ($UserPath) { $UserPath.Split(';') } else { @() } if (-not ($UserPathEntries | Where-Object { $_.TrimEnd('\') -eq $ScriptsDir })) {