windows check kit: per-process section emits no rows (binary + inside an @() literal splits); berth events --json is not a flag #105
Copy link
Copy link
Closed
Description
Ran contrib/windows/check.ps1 against the v0.3.1 windows-amd64 binary (Windows 11 26100, built-in PowerShell 5.1.26100; pwsh 7.6.7 also present — same behavior in both).
- Per-process section: no rows / wrong columns. Root cause: in the row-building lines, e.g.
$rows += ,@($s.pid, "stowaway " + $s.name, $s.used / 1MB, $d)
the binary+(and the division) inside the@(...)literal do not evaluate as one element — PowerShell parses the list so that"stowaway " + $s.namelands as two elements (the literal and the variable), shifting every column. Verified minimally in both PS 5.1 and pwsh 7.6:
@(1, "stowaway " + $x, 2.5, "d")→ 5 elements[1 | stowaway | <x> | 2.5 | d], while hoisting the concat into a variable first → the expected 4. (Depending on how the failure lands, the script also throws[System.Object[]] does not contain a method named 'op_Division'at the division.) Fix: hoist the label (and any arithmetic) into a variable before the@(...)literal. With that fix the table renders all rows with correct columns on this box. - Events section always empty: the script calls
berth events --json; v0.3.1 has no-jsonflag, and the script discards stderr, so the section silently prints "berth events returned nothing". The correct flag is--format json. - Cosmetic: the header prints
powershell: $PSVersionTable.PSVersion.ToString()literally (missing$( )subexpression). - Note:
berth status --format jsonhas noholderskey (it hassquatters,unprotected,leases); the script's null-guard makes this harmless, but the field names have drifted.
A patched copy that completes the checklist is available on request.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
T-Crypt commentedon Oct 21, 2026
PR #107 fixes all four:
@(...)literal, so every row has its four columns again.berth events --format jsonand keeps stderr. An empty answer now prints the exit code instead of "returned nothing".$($PSVersionTable.PSVersion.ToString()). Your report still printsSystem.Collections.Hashtable.PSVersion.ToString(), which fits: your local patch fixed the rows and left the header as it was.berth status --format jsonhas:squatters,unprotectedandleases.Your minimal
@(1, "stowaway " + $x, 2.5, "d")repro saved a lot of guessing. You can takecontrib/windows/check.ps1from main now, and v0.3.3 will ship it.T-Crypt commentedon Oct 21, 2026
v0.3.3 is out and ships the fixed check kit: https://github.com/T-Crypt/berth/releases/tag/v0.3.3. Its
contrib/windows/check.ps1needs no local patch.