Skip to content

Commit 3f0f9c0

Browse files
committed
fix(install): Refresh PATH in current session after install
Made-with: Cursor
1 parent 6b70bfb commit 3f0f9c0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

scripts/install.ps1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ function Write-Info($m) { Write-Host "[INFO] $m" -ForegroundColor Cyan }
88
function Write-Ok($m) { Write-Host "[OK] $m" -ForegroundColor Green }
99
function Write-Err($m) { Write-Host "[ERR] $m" -ForegroundColor Red; exit 1 }
1010

11+
function Refresh-Path {
12+
$machine = [Environment]::GetEnvironmentVariable("PATH", "Machine")
13+
$user = [Environment]::GetEnvironmentVariable("PATH", "User")
14+
$env:PATH = "$machine;$user"
15+
}
16+
1117
$arch = switch ($env:PROCESSOR_ARCHITECTURE) {
1218
"AMD64" { "x86_64-pc-windows-msvc" }
1319
"ARM64" { "aarch64-pc-windows-msvc" }
@@ -35,8 +41,9 @@ try {
3541
Write-Info "Running MSI installer (silent)..."
3642
$p = Start-Process msiexec.exe -ArgumentList "/i","`"$msiPath`"","/quiet","/norestart" -Wait -PassThru
3743
if ($p.ExitCode -eq 0) {
38-
Write-Ok "Installed via MSI. Restart your terminal, then run: forgeStat --version"
3944
Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue
45+
Refresh-Path
46+
Write-Ok "Installed via MSI. Run: forgeStat --version"
4047
exit 0
4148
}
4249
Write-Info "MSI returned exit code $($p.ExitCode), falling back to ZIP..."
@@ -60,7 +67,8 @@ try {
6067
[Environment]::SetEnvironmentVariable("PATH", "$userPath;$InstallDir", "User")
6168
Write-Info "Added $InstallDir to PATH."
6269
}
63-
Write-Ok "Installed. Restart your terminal, then run: forgeStat --version"
70+
Refresh-Path
71+
Write-Ok "Installed. Run: forgeStat --version"
6472
} catch {
6573
Write-Err "Installation failed: $_"
6674
} finally {

0 commit comments

Comments
 (0)