From 4be812649db88adfcd606880ee86052833bfb9a7 Mon Sep 17 00:00:00 2001 From: rebuildup Date: Sun, 29 Nov 2026 12:37:00 +0900 Subject: [PATCH] fix(#257, #263): make the Windows install survive mise's stderr and rewrite the moved pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #257: Windows PowerShell 5.1 turns a native command's stderr into a terminating error while $ErrorActionPreference is Stop, and mise writes its banner to stderr — the build died on the first mise call on a real Windows host. The native build steps now run with the preference relaxed and stderr folded into stdout, judged by their exit code. #263: the state dir rename moved the directory but left `current_app` pointing at the old absolute path. The pointer is rewritten to the new location after the move (POSIX + Windows). --- components/hoxay/common.ps1 | 9 +++++++++ components/hoxay/common.sh | 10 ++++++++++ components/hoxay/install.ps1 | 12 +++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/components/hoxay/common.ps1 b/components/hoxay/common.ps1 index cac2c8e5..3bda1347 100644 --- a/components/hoxay/common.ps1 +++ b/components/hoxay/common.ps1 @@ -30,6 +30,15 @@ function Move-LegacyHoxayStateDir { if (Test-Path $current) { return } if (-not (Test-Path $legacy)) { return } Move-Item -LiteralPath $legacy -Destination $current + # `current_app` holds an absolute path into the moved directory — + # rewrite it, or the pointer keeps addressing the old location. + $appFile = Join-Path $current "current_app" + if (Test-Path $appFile) { + $app = (Get-Content $appFile -Raw).Trim() + if ($app -and $app.StartsWith($legacy, [System.StringComparison]::OrdinalIgnoreCase)) { + Set-Content -Path $appFile -Value ("$current" + $app.Substring($legacy.Length)) + } + } Write-Host "[hoxay] state dir renamed: $legacy -> $current" } diff --git a/components/hoxay/common.sh b/components/hoxay/common.sh index e1b69d01..aece94c3 100755 --- a/components/hoxay/common.sh +++ b/components/hoxay/common.sh @@ -63,6 +63,16 @@ migrate_legacy_state_dir() { return 0 fi mv "$legacy" "$current" || die "cannot move legacy state dir $legacy -> $current" + # `current_app` holds an absolute path into the moved directory — rewrite + # it, or the pointer keeps addressing the old location. + local app_file="$current/current_app" + if [[ -f "$app_file" ]]; then + local app + app="$(cat "$app_file")" + if [[ "$app" == "$legacy"* ]]; then + printf '%s\n' "$current${app#"$legacy"}" > "$app_file" + fi + fi log "state dir renamed: $legacy -> $current" } diff --git a/components/hoxay/install.ps1 b/components/hoxay/install.ps1 index ad2145b7..695a2271 100644 --- a/components/hoxay/install.ps1 +++ b/components/hoxay/install.ps1 @@ -83,12 +83,18 @@ $env:MISE_IGNORED_CONFIG_PATHS = $ignored Push-Location $target try { - mise install --locked | Out-Null + # Windows PowerShell 5.1 turns a native command's stderr into a + # terminating error while $ErrorActionPreference is Stop, and mise + # writes its banner to stderr (rebuildup/pc-setup#257). Run the native + # build steps with the preference relaxed and with stderr folded into + # stdout, and judge them by their exit code. + $ErrorActionPreference = "Continue" + mise install --locked 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { Die "mise install failed" } - bun install --frozen-lockfile | Out-Null + bun install --frozen-lockfile 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { Die "bun install failed" } $env:CSC_IDENTITY_AUTO_DISCOVERY = "false" - bun run desktop:pack | Out-Null + bun run desktop:pack 2>&1 | Out-Null if ($LASTEXITCODE -ne 0) { Die "electron-builder failed" } } finally { Pop-Location