Skip to content

bug(cli): Windows installer run through irm | iex closes the caller's PowerShell on error #5174

Closed

Description

@tale-code-bot

Part of #4839 (split from it in task TALE-176).

Problem

#4839 defect 3.

# Defect Code What the operator sees
3 The documented Windows install closes the operator's PowerShell when the installer reports an error. irm … | iex runs the script in the caller's session. So its exit ends that session, and its preference change stays there docs/en/self-hosted/install/cli-install.md:35 irm https://raw.githubusercontent.com/tale-project/tale/main/scripts/install-cli.ps1 | iex. The same line is at docs/en/self-hosted/install/quickstart.md:36, in the DE and FR guides, and in the script's usage line (scripts/install-cli.ps1:3). scripts/install-cli.ps1:29 function Write-Err { param($msg) Write-Host "Error: $msg" -ForegroundColor Red; exit 1 } is the script's only exit, and every error the script reports goes through it (12 calls, :108 to :363). :17 $ErrorActionPreference = "Stop" runs in the caller's scope On every error the installer reports, the console window closes. The red "Error: …" line and its recovery hints go with it, for example "The installed binary did not run. Common causes:" and its two causes (:360-362), printed just before Write-Err at :363. After a successful install, the session keeps ErrorActionPreference=Stop

Notes, all at 29e9445:

  • The installer tests never take the iex path. runPowerShell (tools/cli/scripts/install-cli.test.ts:261-289) writes the script without its trailing Main call (:255-259), adds the test code, and runs the file with -File in a fresh process (:271-279).
  • In that mode the checksum scenarios expect exit code 1 for each refusal (:337-360, asserted at :378).
  • The script already has a main function: Main (:366-380), called once at :382.

Expected

  • In the PowerShell installer, throw (or return from a main function) instead of exit, and don't change the caller's ErrorActionPreference.
  • Add an installer test that runs the script through iex in a child session.

Regression: a PowerShell test that the calling session survives an installer error. Add it to the describe.skipIf(!powershell)('PowerShell CLI installer' block (tools/cli/scripts/install-cli.test.ts:291): a child PowerShell session runs the installer through iex, with an installer error forced (for example a failed download or a checksum mismatch). After the error, the session still runs a following command, and $ErrorActionPreference has its original value. At 29e9445 the session ends at exit 1 (scripts/install-cli.ps1:29), so the following command never runs.

Severity and owner

Activity

  1. added
    bug
    agent-ready
    on Oct 30, 2026
  2. added a commit that references this issue on Oct 31, 2026
    5224003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions