From 38af74581f43bfac7a03d6ede477695dd9639feb Mon Sep 17 00:00:00 2001 From: jon Date: Wed, 22 Jul 2026 14:51:44 -0500 Subject: [PATCH] fix(install-windows): don't let a missing Ollama process abort the last step taskkill writes to stderr when the process isn't running, and with $ErrorActionPreference = Stop PowerShell 5.1 promotes native stderr to a terminating error (2>$null doesn't prevent it). The normal case -- Ollama not running -- threw and printed a failure warning for work that had succeeded. Uses Get-Process | Stop-Process instead. Co-Authored-By: Claude Opus 4.8 --- install-windows.ps1 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/install-windows.ps1 b/install-windows.ps1 index f800bac..6dad9cc 100644 --- a/install-windows.ps1 +++ b/install-windows.ps1 @@ -228,8 +228,16 @@ try { Remove-Item $ollamaAutostart -Force Write-OK "Removed Ollama login autostart" } - foreach ($img in @("ollama app.exe", "ollama.exe")) { - taskkill /F /T /IM $img 2>$null | Out-Null + # Get-Process, not taskkill: taskkill writes "ERROR: The process ... not + # found." to stderr when nothing is running, and with $ErrorActionPreference + # = Stop PowerShell 5.1 promotes a native command's stderr to a TERMINATING + # error. `2>$null` does not prevent that. So the ordinary case - Ollama + # simply is not running - aborted this whole block and printed the warning + # below, claiming the install could not configure something it had in fact + # already done. Cmdlets have no such trap. + foreach ($name in @("ollama app", "ollama")) { + Get-Process -Name $name -ErrorAction SilentlyContinue | + Stop-Process -Force -ErrorAction SilentlyContinue } Write-OK "Ollama set to manual start" } catch {