Repository navigation
Closed
Labels
Description
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
iexpath.runPowerShell(tools/cli/scripts/install-cli.test.ts:261-289) writes the script without its trailingMaincall (:255-259), adds the test code, and runs the file with-Filein 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(orreturnfrom a main function) instead ofexit, and don't change the caller'sErrorActionPreference. - Add an installer test that runs the script through
iexin 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
- Severity: medium, from bug(cli): digit-led project names can never deploy, --host rewrites .env even on --dry-run, and the Windows installer closes the session on error #4839: "(3) hides the installer's own diagnostics".
- Owner: CLI (installers).
- Evidence: static reading at
train29e9445, same atfeature-train12625af (the install guides differ there, but not at the cited lines); nothing was run. The cited paths are unchanged attrain1ae4a95 andfeature-train2334ceb. - Related: release: re-running the v0.5.78–v0.5.80 releases moved
:latestimages and GitHub Latest back to v0.5.79 #4740 (installer release fallback); bug(cli): Unix installer calls API errors a missing release, and its build hint is wrong #5173, the Unix installer's API errors, whose Windows mirror isinstall-cli.ps1:215.
Activity
fix(cli): keep the caller's PowerShell session when the installer fails