Repository navigation
docs/boot.md: the Windows PowerShell 5.1 capture survives ErrorActionPreference Stop (PROC-271) - #5330
docs/boot.md: the Windows PowerShell 5.1 capture survives ErrorActionPreference Stop (PROC-271)#5330LouisRiverstone wants to merge 2 commits into
Conversation
…Preference Stop (PROC-271)
With $ErrorActionPreference = 'Stop', 5.1 turns the first native stderr line
into a terminating error, so '2>&1 | Out-File -Encoding utf8 $log' stops the
run and the log has no [d3d12-trace] line. The capture now runs inside
'& { $ErrorActionPreference = 'Continue'; ... 2>&1 } | Out-File', as
scripts/first_look.ps1 does. Measured on Windows PowerShell 5.1.26100 with a
stand-in printing three trace lines to stderr: bare capture 3 with Continue,
0 with Stop; the block 3 with both, exit code kept, the outer preference left
as it was.
kacper-serewis
left a comment
There was a problem hiding this comment.
AI-assisted Windows PowerShell 5.1.26100.9818 verification at 9a9e787. With caller ErrorActionPreference=Stop, the documented block captured stdout and all three native stderr lines for both exits 0 and 37. The file had the expected UTF-8 BOM; the first stderr line was formatted as NativeCommandError. Caller preference remained Stop. LASTEXITCODE preserved the native status, while $? was true in both runs because Out-File succeeded. Checked with a synthetic native process, CPU only.
|
Thanks @kacper-serewis. Your run adds a non-zero exit (37), and it confirms |
Kam471
left a comment
There was a problem hiding this comment.
Head 9a9e787041.
tests/test_docs_*.py (all) -> OK
git diff --check -> clean
Reproduced the claim on Windows PowerShell 5.1.26100.9444 with a stand-in that prints one stdout line and three [d3d12-trace] lines to stderr, session $ErrorActionPreference = 'Stop':
| capture | lines in log |
|---|---|
bare 2>&1 | Out-File -Encoding utf8 |
1 (stdout only; no trace line) |
the documented & { $ErrorActionPreference='Continue'; ... 2>&1 } | Out-File |
all 3 trace lines, plus the first line's error record |
The block leaves the outer preference at Stop and keeps $LASTEXITCODE (0). The text matches scripts/first_look.ps1's dry-run capture, and the BOM / program.exe : sentences are unchanged. The PR already notes the overlap with #4424 on this paragraph.
Verdict: good.
|
Read 9a9e787: pass with notes
Read:
AI-assisted (Claude Code). Generated by Claude Code |
# Conflicts: # docs/boot.md
|
Merged current Re-measured on Windows PowerShell 5.1.26100.9444 with a stand-in that prints three trace lines to stderr and exits 37:
So the doc now wraps |
|
Tested f99e0b9 merged with main 561b65a (merge was a no-op) on Linux (WSL2) with Python 3.12.16 and natively on Windows PowerShell 5.1.26100.9818: pass Docs-only change (docs/boot.md). tests/test_docs_*.py: 11 files run, 11 passed, 0 failed. Re-ran the claim on Windows PowerShell 5.1 with a
Negative control: the "no block, Stop" case above is the control (0 lines). No code or test change in the PR. |
larpinguser
left a comment
There was a problem hiding this comment.
Summary: docs/boot.md wraps the gta6rt trace capture in & { $ErrorActionPreference = 'Continue'; ... } and explains that Windows PowerShell 5.1 with Stop otherwise turns the first stderr trace line into a terminating error and drops the log. It references the same pattern in scripts/first_look.ps1.
Why merge: Capture instructions now work under strict profiles without changing session preferences.
Verdict: Approve
|
Summary: Why merge: Capture instructions now work under strict profiles without changing session preferences. Verdict: Approve |
PROC-271 (found by
dracbat):docs/boot.md's Windows PowerShell 5.1 log capture records nothing when$ErrorActionPreferenceisStop.Why. Under
Stop, 5.1 turns the first native stderr line into a terminating error.2>&1 | Out-File -Encoding utf8 $logthen stops the run there, and the log has no[d3d12-trace]line, so the report reads as a run with no D3D12 call. A profile or script can setStopwithout the reader knowing.What changed. The doc now gives the 5.1 capture as a block:
(After #4424 landed, this wraps its
ForEach-Object/-Width 4096pipeline, which on its own also writes 0 lines underStop: re-measured on 5.1.26100.9444.)This is the same pattern
scripts/first_look.ps1uses for its dry run. The doc also explains why the block is there. What it says about the BOM and theprogram.exe :prefix is unchanged.Verify. I ran this on Windows PowerShell 5.1.26100.9444 with a stand-in
.cmdthat prints one stdout line and three[d3d12-trace]lines to stderr:ContinueStop2>&1 | Out-File -Encoding utf8(main)With
Stopset in the session, I also ran the block exactly as written in the doc, on several lines. It keeps all three lines and$LASTEXITCODE(0), and it leaves the outer$ErrorActionPreferenceatStop. Thetests/test_docs_*.pychecks pass.Overlap. #4424 (@AGInformatique81, which reads UTF-16 logs) rewrites this paragraph as well, and as the finding notes it has the same exposure. Whichever lands second will need a small rebase.
No game files.
AI-assisted (Claude Code): I reviewed and ran the PowerShell checks above.