Skip to content

El instalador dejaba rota la shell que lo ejecutaba - #11

Merged
borjaperfra merged 1 commit into
mainfrom
fix/no-session-pollution
Sep 14, 2026
Merged

borjaperfra merged 1 commit into
mainfrom
fix/no-session-pollution

Conversation

@borjaperfra

Copy link
Copy Markdown
Contributor

Reported: after the installer finishes, the terminal shows a bare PS> and nothing typed at it does anything. Second report of the same thing — and it was never Warp.

Why

iex runs this script in the caller's session, so the two preference assignments at the top of it were assignments to their shell, for the rest of its life.

$ErrorActionPreference = 'Stop' left behind that way turns every later non-terminating error in that session into a terminating one — including inside the prompt function a terminal like Warp installs to know where a command begins and ends. When that throws, PowerShell falls back to its built-in PS> prompt and the terminal has lost the session: the prompt sits there and the keyboard goes nowhere.

Confirmed rather than guessed, both halves:

PS> '$ErrorActionPreference = ''Stop''' | iex
PS> $ErrorActionPreference
Stop                      # the caller's session, changed for good
prompt function with a non-terminating error inside it:
  under Continue -> returns the prompt
  under Stop     -> throws ItemNotFoundException

The fix

Inside a function the same assignment is local and goes away with the call, so that is where both of them live now. Verified: the session reads Continue on both preferences after a full install.

CI

Refuses any preference variable assigned at script scope — the class, not the instance. Seen failing against a reintroduced one.

Version goes to 0.1.10.

Reported: after the installer finishes, the terminal shows a bare `PS>` and
nothing typed at it does anything. Second report of the same thing, and it was
never Warp.

`iex` runs this script in the caller's session, so the two preference
assignments at the top of it were assignments to their shell, for the rest of
its life. $ErrorActionPreference = 'Stop' left behind that way turns every
later non-terminating error in that session into a terminating one - including
inside the `prompt` function a terminal like Warp installs to know where a
command begins and ends. When that throws, PowerShell falls back to its
built-in `PS>` prompt and the terminal has lost the session: the prompt sits
there and the keyboard goes nowhere.

Confirmed rather than guessed, both halves:

  '$ErrorActionPreference = ''Stop''' | iex   leaves the session on Stop
  a prompt function with a non-terminating error throws under Stop, and
  does not under Continue

Inside a function the same assignment is local and goes away with the call, so
that is where both of them live now. Verified: the session reads Continue on
both preferences after a full install.

CI refuses any preference variable assigned at script scope, which is the
class rather than the instance. Seen failing against a reintroduced one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@borjaperfra
borjaperfra merged commit 16865d7 into main Sep 14, 2026
2 checks passed
@borjaperfra
borjaperfra deleted the fix/no-session-pollution branch September 14, 2026 11:31
borjaperfra added a commit to helmcode/nan that referenced this pull request Sep 14, 2026
v0.1.9 and everything before it left `$ErrorActionPreference = 'Stop'` in the
shell that ran them, because `iex` executes in the caller's session. That turns
every later non-terminating error there into a terminating one - including
inside the prompt function a terminal installs to track its blocks - so the
session ended on a bare `PS>` with a keyboard that went nowhere. Both
preferences are function-scoped now. helmcode/nan-cli#11.

Co-authored-by: borjaperfra <borjaperfra@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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