Skip to content

fix: don't kill the user's shell when git is missing - #281

Merged
NejcS merged 1 commit into
Codeplain-ai:mainfrom
sunasrd-byte:fix/installer-exit-kills-shell
Aug 12, 2026
Merged

fix: don't kill the user's shell when git is missing#281
NejcS merged 1 commit into
Codeplain-ai:mainfrom
sunasrd-byte:fix/installer-exit-kills-shell

Conversation

@sunasrd-byte

Copy link
Copy Markdown
Contributor

The documented install path is irm https://codeplain.ai/install.ps1 | iex, which runs the script in the caller's scope. exit 1 there terminates the interactive session, so the window closes before the user can read why. On a fresh machine without git, Assert-Git printed the install instructions and then destroyed the window mid-sentence.

Route both abort paths through Stop-Install: it sets $LASTEXITCODE but calls
exit only when no interactive window is at stake -- a file-based run ($PSCommandPath) or an unattended one ($nonInteractive), where pwsh Command takes its exit code from exit alone. Callers return to stop the script.

Related to https://linear.app/codeplain/issue/ENG-191/powershell-install-script-closes-terminal-if-it-fails

The documented install path is `irm https://codeplain.ai/install.ps1 | iex`,
which runs the script in the caller's scope. `exit 1` there terminates the
interactive session, so the window closes before the user can read why. On a
fresh machine without git, Assert-Git printed the install instructions and then
destroyed the window mid-sentence.

Route both abort paths through Stop-Install, which sets $LASTEXITCODE and calls
`exit` only when the run has no interactive window to lose: a file-based run
($PSCommandPath) or an unattended one ($nonInteractive). Unattended runs need
it because `pwsh -Command "irm ... | iex"` takes its process exit code from
`exit` and ignores $LASTEXITCODE, so a CI install that aborted here would
otherwise report success. Callers `return` to stop the remaining script.

Also build the git-detected check mark from its code point. A literal U+2713 in
a BOM-less file is read as CP1252 by Windows PowerShell 5.1, where it decodes
to a smart quote that terminates the string; the lint-powershell workflow
already forbids this.
@NejcS
NejcS self-requested a review August 12, 2026 11:44
@NejcS
NejcS merged commit bc05e46 into Codeplain-ai:main Aug 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants