startup: preserve debugger stderr and exit status #2867
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!2867
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2867"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@louisdibiasi on GitHub · 2026-11-26 14:58 UTC · original
louisdibiasi:louis/startup-debugger-stderr→main· +47 −10 · 2 files · 4 commits · merged 2026-11-28 02:22 UTCChange
On Windows PowerShell 5.1, a debugger that writes to stderr can trigger
NativeCommandErrorunder the launcher's stop-on-error preference. The launcher then exits 1 before printing its summary, even when the debugger returned 0 or another exit code. ScopeContinueto the debugger invocation and capture its exit code before returning to the launcher's normal error handling.#2822 edits the same invocation to add capture arguments, and #2820 also changes this script and its check. These are separate behaviors; whichever lands later may need to carry both changes.
Verification
Windows, base
b505c32b, patch heada4d2114e:out\pe-env\Scripts\python.exe -B tests\startup_run_ps1_check.py— passed with Windows PowerShell 5.1 and PowerShell 7. Synthetic debugger cases cover stderr with exit 0 and 7, the watcher cleanup path, and missing Python. A source-built debugger log-open failure checks that itsPermissionErrorreaches the summary; the no-stderr path is a control.out\pe-env\Scripts\python.exe -B tests\startup_run_ps1_check.py --text-only— passed.out\pe-env\Scripts\python.exe -B tests\bidi_controls_check.py— passed.. .\tools\dev.ps1; cmake --build --preset pr; ctest --preset pr --no-tests=error— build passed; 36 tests passed and four min-LOD WARP tests skipped.dev.ps1reported thatvswhere.exewas not on PATH; the configured build completed.git diff --check upstream/main— passed.The first sandboxed launcher check failed to remove a still-open synthetic watcher log; the host rerun above passed. No title executable or hardware behavior was tested.
Evidence and follow-up
The debugger stub and failure input are generated by the test; the real debugger case uses repository source and a synthetic directory at the log-file path. On the unpatched script, the PowerShell 5.1 stderr cases returned 1 and missed the summary; PowerShell 7 served as a control.
AI-assisted.
Checklist
@R0Y00 on GitHub · 2026-11-27 08:03 UTC · original · reviewed
The integration trial for
a4d2114eafter #2870 conflicts intests/startup_run_ps1_check.py;tools/startup/run.ps1merges cleanly. Please update against currentmain(3b6c38a8) and keep both the stderr/exit-status cases and #2870's three manifest controls, including the stub's title ID and storage quota fields. I’ll rerun the full fixture under Windows PowerShell 5.1 and PowerShell 7 on the updated head.@pigalot on GitHub · 2026-11-28 02:15 UTC · original
I merged
main50e4f763into this branch as3dc23410(a merge commit on top of0f3da303; no rebase and no force-push). Againstmain, the branch still changes onlytools/startup/run.ps1andtests/startup_run_ps1_check.py.Conflicts and how I resolved them.
tools/startup/run.ps1:mainadded--capture-every(@captureArgs) to the debugger call. I kept this branch's Windows PowerShell 5.1 wrapper (& { $ErrorActionPreference = "Continue"; ... $script:debuggerExit = $LASTEXITCODE } *> "$LogDir.out") and passed@traceArgs @captureArgsinside it.tests/startup_run_ps1_check.py:run_casenow takes both sides' parameters:emit_stderr,missing_pythonandreal_log_errorfrom this branch, andnativeandcache_filesfrommain..outsummary handling comes first, thenmain's stale shader-cache warning check.One change outside the conflict hunks.
main'sdebug_launch.pynow importshook_windowandwindow_captureat the top. The real-debugger-log case copied onlydebug_launch.py,launch.pyandhost_cpu.py, so on top ofmainit failed:real debugger log error was not captured in the summary;powershellandpwsh.I added the two modules to that case's copy list. With that,
tests/startup_run_ps1_check.pyreports0 failed (executed with powershell, pwsh).What I ran. I built the whole tree in
devandrelease, then ran:14 of 15 pass in Debug and in Release
/O2.startup_run_shreports a capability skip (77), as on every Windows host; the Ubuntu job runs it.git diff --check origin/main...HEADis clean.R0Y00's request on
a4d2114ewas to keep both the stderr/exit-status cases and #2870's manifest controls, and both are still there. This needs a review from someone other than me before it can be merged.Environment: Windows 11 25H2 build 26200.9974, MSVC 19.52.37029, Python 3.12.10, Windows PowerShell 5.1 and PowerShell 7.
This reply was AI-assisted.
@R0Y00 on GitHub · 2026-11-28 02:22 UTC · original · approved these changes
Reviewed
3dc23410dbintegrated on mainf9286e7d(tree65eb01655e). The rebased fixture retains the three manifest controls from #2870. ErrorActionPreference is scoped to the debugger invocation, its exit code is captured before cleanup, and the launcher reports it after the finally block.On Windows 11 26200.9974, tests/startup_run_ps1_check.py passed on Windows PowerShell 5.1 and PowerShell 7. The stderr-with-exit-0 and stderr-with-exit-7 cases preserved the summary and status, the source-built debugger log-open error reached the summary, and the watcher-cleanup and missing-build controls passed. The text-only and bidi checks also passed:
Hosted Windows, Linux Python and gfx1013 checks passed. These were source-built launcher checks.