Repository navigation
fix(upgrade): make capa upgrade work on Windows - #304
Merged
Merged
Conversation
capa upgrade runs install.ps1 with powershell.exe, which is always Windows PowerShell 5.1. 5.1 reads a BOM-less script as Windows-1252, so the UTF-8 check mark and box-drawing glyphs decoded into stray smart quotes and the script failed to parse. It never ran a single line. The failure was invisible because the installer was spawned detached with stdout/stderr ignored. - install.ps1 is ASCII-only now; `e (a 7.0-only escape) becomes [char]27 - run the Windows installer in the foreground with inherited stdio and a real exit code, same as install.sh; the installer already renames the running capa.exe aside, so capa doesn't need to exit first - test that install.ps1 stays ASCII-only
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
capa upgradehas never worked on Windows. It runsinstall.ps1withpowershell.exe(always Windows PowerShell 5.1), which reads a BOM-less script as Windows-1252. The UTF-8✓/ box-drawing glyphs decode to bytes that include0x93, a smart quote PowerShell treats as a string delimiter, so the script fails to parse before running a single line. Nobody saw the error because the installer was spawned detached with stdout/stderr ignored.What changed
install.ps1is ASCII-only: plainOKand+---+borders instead of glyphs, and[char]27instead of`e(a 7.0-only escape that printed a literaleon 5.1)capa upgraderuns the Windows installer in the foreground with inherited stdio and checks its exit code, same as theinstall.shpath. The installer already renames the runningcapa.exeaside (Upgrade fails on Windows #19), so capa doesn't need to exit first.install.ps1must stay ASCII-onlyScreenshots / logs
Before (PS 5.1 parsing the v2.3.0
install.ps1):parse errors: 6, starting with213: Unexpected token 'Directory' in expression or statement.After:
parse errors: 0, and the installer runs toCAPA installed successfully!, exit 0.Test plan
Parser::ParseFileon the fixed script: 0 errors (6 before)powershell.exe -Fileexactly ascapa upgradedoes: 2.2.0 to 2.3.0, exit 0capa.exe __server__was running from the install dir: new binary landed, the old one was left ascapa.exe.oldinstall.ps1and passes here;upgrade-plan.test.ts8/8Checklist
bunx tsc --noEmitpassesbun run smellsclean vs base (or CI Qlty Smells job green)Takes effect from the release after this lands: the running capa runs whatever
install.ps1ships in the target release, so going from 2.3.0 to the next version is the first upgrade that benefits.🤖 Generated with Claude Code