Repository navigation
Description
The PowerShell style guide's section 7, Messages and Failure (NobleFactor/noblefactor-engprod#311, 0f8b2fd, 2026-10-18), says how a script narrates, fails and reads native programs. install.ps1 on develop (4d18e48c; last changed by #1032) predates it. Compared 2026-10-19:
| Area | Section 7 | install.ps1 today |
Line | |
|---|---|---|---|---|
| 🔴 | Streams | Narration goes to Write-Verbose; nothing goes to the information stream |
All narration goes to Write-Information (Write-Info, Write-Success, blank lines) |
147, 158, 749 |
| 🔴 | Streams | No stream is turned on by force | Every Write-Information carries -InformationAction Continue |
throughout |
| 🔴 | Streams | A result is an output object | The usage, the PATH advice, "Verify installation" and the next steps are information-stream text | 76–92, 919–963 |
| 🟢 | Streams | A warning goes to Write-Warning |
It does | 169 |
| 🟢 | Streams | No Write-Host |
None | — |
| 🟢 | Streams | The caller's preferences stay the caller's | Only $ErrorActionPreference is set |
— |
| 🔴 | Errors | Note the caller's error action, then set Stop |
Sets Stop without noting the caller's |
68 |
| 🔴 | Errors | Catch every error; restore the caller's error action; report with $PSCmdlet.WriteError |
Main has try/finally only; errors leave the script uncaught |
800, 866 |
| 🔴 | Errors | A refusal is the script's own ErrorRecord, with an id and a category |
Write-Fatal throws a string, at about twelve call sites |
184 |
| 🔴 | Errors | Off Windows, the RequiresWindows record |
Get-OSName throws the string "This script requires Windows." |
201 |
| 🟡 | Errors | exit 1 after reporting |
Never exits: under irm | iex and the script-block form, exit ends the user's session (#965). Ruled below: return |
72, 184 |
| 🟢 | Native programs | Read through .NET Process, UTF-8 with no BOM |
It does | 615–625 |
| 🟢 | Native programs | Each argument passed as given | ArgumentList on PowerShell 7; one quoted command line on Windows PowerShell 5.1, which a fresh Windows machine has (#948) |
629–636 |
| 🔴 | Native programs | Standard input redirected and closed | Only stdout and stderr are redirected | 617–638 |
| 🔴 | Native programs | What the program narrates goes to verbose | Each line of its stderr goes to Write-Information |
646 |
Ruled 2026-10-19
Asked whether the catch ends with section 7's exit 1 or returns, as #965 requires: "return, per #965. file it."
Resolution
- Narration, the program's stderr included, goes to
Write-Verbose; warnings stay onWrite-Warning. NoWrite-Information, no-InformationAction. - The usage, the PATH advice and the next steps are output on the success stream.
- The script notes the caller's error action, sets
Stop, and runs its work intry/catch. Thecatchrestores the caller's error action, reports the error with$PSCmdlet.WriteError, and returns. - Every refusal is an
ErrorRecordof the script's own, with an id and a category, thrown inside the caught work;Write-Fatalgoes. Invoke-NativeCommandredirects standard input and closes it.- Windows PowerShell 5.1 still runs it (install.ps1 is published beside install.sh, and runs on Windows PowerShell 5.1 — what a fresh Windows machine has #948), and
irm | iexstill leaves the user's session open (install.ps1's exit closes the user's PowerShell window: under irm | iex and the script-block form, exit ends the session, not the script #965). scripts/Test-InstallScript.ps1checks the streams and the error records, and the installers' CI passes on every leg.scripts/Test-InstallScript.ps1itself narrates and fails as section 7 says: it too writesWrite-Information -InformationAction Continuethroughout and throws strings (:342,:357,:366). Amended 2026-10-19, auditing Schedule: the install scripts tell the truth, upgrade fetches, and Windows has an installer #949: "log everything, put them on Schedule: the install scripts tell the truth, upgrade fetches, and Windows has an installer #949."
A plain irm | iex run then shows warnings, errors and its results; progress shows with -Verbose.
Plan and design documents
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(install): no byte-order mark reaches a program install.ps1 runs u…