startup: run.ps1 exits 1 instead of the debugger's exit code when taskkill reports an error for the -Translate watcher #2272
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#2272
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@alvaroolt on GitHub · 2026-11-25 09:09 UTC · original
Commit or build
mainat1a713de0(tools/startup/run.ps1line 79, added in37aefadf/ #2120)Reproduction
run.ps1sets$ErrorActionPreference = "Stop"and stops the-Translatewatcher in afinallyblock:Windows PowerShell 5.1 turns each stderr line of a native command redirected with
2>&1into an error record, andStopturns it into a terminating error. Whenevertaskkillwrites to stderr, the script therefore aborts. Before it aborts, it has printed neither the head of<LogDir>.outnor runexit $debuggerExit. A standalone script shows the mechanism:Through
run.ps1itself, with the stub tree oftests/startup_run_ps1_check.py(no title files, no debugger): replaceWATCH_STUBwith a watcher that writeswatch.jsonand exits at once, then callrun_case(shell, script, code, tmp, translate=True)for debugger exit codes 0 and 7.Expected behavior
run.ps1 -Render -Translateprints the first five lines of<LogDir>.outand exits with the debugger's exit code, as it does without-Translate(#1603). This should hold whether the watcher is still running or has already exited (crash, bad cache path or early return) when the debugger finishes. It should also hold when part of its process tree is already gone whiletaskkill /Twalks it.Observed behavior
With a watcher that has already exited, both cases fail the same way (run with the check from #2271, which reads the localized warning prefix):
The debugger's exit code is lost and the log head is not printed.
The same error also appeared once, intermittently, with the normal long-running watcher stub. That happened in the
-Translatecase oftests/startup_run_ps1_check.pyduring a fulltools/run_checks_parallel.pyrun:run.ps1 exited 1, with stderrtaskkill.exe : ERROR: el proceso con PID … (proceso secundario de PID …)(Spanish Windows) pointing at line 79. The check then passed in 8 of 8 serial runs and in 8 of 8 runs started at once, so this path is rare. A watcher that has already exited reproduces the failure every time.A possible direction, for whoever picks this up: stop the tree without letting
taskkill's stderr become a terminating error. For example, check$translator.HasExitedfirst and runtaskkillwith a local$ErrorActionPreference = "Continue", or throughStart-Process -Wait. Add a case totests/startup_run_ps1_check.pywith a watcher that exits early, which must still yield the debugger's exit code and the log head. The existing cleanup controls from #2222 still apply.Environment
Windows 11 build 26300.9974 (UI language es-ES), Windows PowerShell 5.1.26100.9818, Python 3.12.
pwsh7 was not tested; its handling of native stderr underStopdiffers from 5.1. No GPU involved.Checklist
This report was AI-assisted (Claude Code); I reviewed the reproduction and its output.
@RavenCurseBurg on GitHub · 2026-11-25 09:15 UTC · original
I’ll take this using the existing synthetic launcher fixture on Windows PowerShell 5.1 and PowerShell 7. I’ll check the five-line output and debugger exit codes 0 and 7 after the watcher has actually exited, and retain the live parent/child cleanup controls from #2222. I’ll also check the stderr race independently of the early-exit case.