launcher: propagate the run's exit code and report discarded values #459
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!459
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-459"
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?
@Jackster on GitHub · 2026-11-27 03:16 UTC · original
Jackster:launcher/exit-code→a-publier· +25 −7 · 1 files · 1 commits · openWhat
Two defects in
scripts/play.ps1, the launcher the README documents.1. It swallowed the exit code. The script ended with
so a failing run left the caller with 0 — a wrapper or CI job cannot tell "the game ran" from "the FSR DLL was missing". Measured with the same script shape: child exits 7, caller saw 0. Now the code is taken right after the call,
Pop-Locationstill runs, and the script exits with it. Verified on this branch with the real launcher and a malformed-title file (never starts the title): the caller now sees 1 where it saw 0. A$code = 1default covers a failure that never reaches the child's code.2. The "Discarded inherited values" message misreported. The old comparison ran after the script had set its own values, so a name the script overrides with a different value was reported as discarded, and the message could not distinguish "dropped" from "replaced". Now the script snapshots the inherited values before removing them and reports two accurate things:
-More.A name the script sets to the same value is silent (it is already what the user asked for), and names passed through
-Moreare applied, so they are reported neither way.$paths(game, cache, data, …) are still never touched.VICTORY_RELAY=2(script sets the same)VICTORY_THIN=0(script sets a different value)VICTORY_SOMETHING=1(script never sets it)-MoreTesting
Exercised with the real launcher against the already-built
target\diag\victory.exeand a non-PE-Exe, sovictory runfails fast and the title never starts:$LASTEXITCODE = 0; after:1PowerShell.Exitinghandler)Switch set,
-Safe,-More,-Build, the$pathsblock and the early guards are unchanged. Nothing else in the tree is touched.Not in this PR
-Safestill leaves most fast-path switches on (it unsets three), which is a design question rather than a bug; and thevictory runexit-code contract (the CLI always exits 0 after printing the title's code) is a maintainer decision.play.ps1 ended with `try { & $victory run ... } finally { Pop-Location }`, so a failing run left the caller with 0 and no wrapper could tell a run that failed from one that played. Take the child's code right after the call, restore the directory in the finally, and exit with it; a failure that never reaches the child's code exits 1. The "Discarded inherited values" message compared against the live environment after the script had already set its own values, so a value the script overrides with a different one was reported as discarded, and a dropped value could not be told from a replaced one. Snapshot what was inherited before removing it, then report removed-and-not-set-again as discarded and set-to-another-value as overridden, in two sentences. A name set to the same value, or passed through -More, is silent.@lvndrpup on GitHub · 2026-11-27 04:41 UTC · original · reviewed
Checked on Windows 11 build 26300, Windows PowerShell 5.1. I ran the
4eb6cfdandca8177bversions ofscripts/play.ps1against a stubtarget\release\victory.exethat prints theVICTORY_*values it gets and exits with a chosen code, each case in a freshpowershell.exewith only the listed value inherited.4eb6cfdpowershell -File play.ps1 ...-File& play.ps1 ...from a session, then$LASTEXITCODEVICTORY_RELAY=2(script sets the same)VICTORY_THIN=0(script sets 1)Discarded inherited values for VICTORY_THINOverrode inherited values for VICTORY_THIN with this script's settingsVICTORY_SOMETHING=1(script never sets it)Discarded ... VICTORY_SOMETHINGVICTORY_THIN=0and-More @{VICTORY_THIN='0'}So the exit-code fix is for
-Filecallers (a CI step, a shortcut, a wrapper script). Someone calling it with&from an open window already saw the code through$LASTEXITCODE, so the description's "caller saw 0" is true of-Fileonly. The child got the sameVICTORY_*values in every case with both versions.Overlap: #398 adds a folder check a few lines above; the two merge cleanly.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.