From a51824eeec044eebd81b6a81f620275c51548a3a Mon Sep 17 00:00:00 2001 From: rebuildup Date: Sun, 29 Nov 2026 12:53:53 +0900 Subject: [PATCH] fix(#265): stop the running app before the Windows build replaces its executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows the app runs from the release directory, so a running instance locks the executable the build replaces and electron-builder fails (observed on a real Windows host: update.ps1 over a running install). The app owns no herdr session — panes, agents and workspaces live in herdr — so stopping it before the build is safe. --- components/hoxay/install.ps1 | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/components/hoxay/install.ps1 b/components/hoxay/install.ps1 index 695a2271..30d45e67 100644 --- a/components/hoxay/install.ps1 +++ b/components/hoxay/install.ps1 @@ -26,6 +26,27 @@ New-Item -ItemType Directory -Force -Path $ReleasesDir, $LogDir | Out-Null function Log($msg) { Write-Host "[hoxay] $msg" } function Die($msg) { Write-Host "[hoxay] ERROR: $msg" -ForegroundColor Red; exit 1 } +# Stop a managed app that is running from a release directory. The build +# replaces the executable in place, so a running instance has to go first. +function Stop-ManagedApp { + $names = @("hoxay", "herdr-t3") + $running = Get-Process -Name $names -ErrorAction SilentlyContinue + if (-not $running) { return } + foreach ($p in $running) { + Log "stopping running $($p.ProcessName) (pid $($p.Id))" + try { $p.CloseMainWindow() | Out-Null } catch { } + } + for ($i = 0; $i -lt 25; $i++) { + if (-not (Get-Process -Name $names -ErrorAction SilentlyContinue)) { return } + Start-Sleep -Milliseconds 200 + } + Get-Process -Name $names -ErrorAction SilentlyContinue | ForEach-Object { + Log "force stopping $($_.ProcessName) (pid $($_.Id))" + Stop-Process -Id $_.Id -Force -ErrorAction SilentlyContinue + } + Start-Sleep -Seconds 1 +} + if (-not $Ref) { # Stable release tags only: a prerelease tag like v1.1.0-rc.1 would fail # the [version] cast below and must never win auto-selection. @@ -56,6 +77,14 @@ if (-not (Test-Path (Join-Path $target ".git"))) { git -C $target checkout --quiet $Ref if ($LASTEXITCODE -ne 0) { Die "git checkout $Ref failed in $target" } $commit = (git -C $target rev-parse HEAD).Trim() + +# The app runs from the release directory, so a running instance locks the +# executable the build replaces and electron-builder fails (observed on a +# real Windows host: `update.ps1` over a running install). The app owns no +# herdr session — panes, agents and workspaces live in herdr — so stopping +# it is safe. +Stop-ManagedApp + Log "building $name ($commit)" # `mise install --locked` must see only the checkout's own mise.toml /