fix: don't kill the user's shell when git is missing - #281
Merged
NejcS merged 1 commit intoAug 12, 2026
Conversation
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
self-requested a review
August 12, 2026 11:44
NejcS
approved these changes
Aug 12, 2026
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.
The documented install path is
irm https://codeplain.ai/install.ps1 | iex, which runs the script in the caller's scope.exit 1there 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
exitonly when no interactive window is at stake -- a file-based run ($PSCommandPath) or an unattended one ($nonInteractive), wherepwsh Commandtakes its exit code fromexitalone. Callersreturnto stop the script.Related to https://linear.app/codeplain/issue/ENG-191/powershell-install-script-closes-terminal-if-it-fails