play.ps1: exit with the child's code, and let captures through (#3, #19) #101

Closed
xiaotu030202 wants to merge 1 commit from upstream-pr/101 into main
xiaotu030202 commented 2026-11-25 12:07:09 +00:00 (Migrated from github.com)
First-time contributor

Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T11:26:04Z.


Closing this: #15 and #22 already do both halves, more precisely, and I did not check the open pull requests before writing it.

what this PR did already in flight
exit with the child's code (#3) #15 Launcher: propagate the native process exit code, +3/−1
-Capture / -Keys switches + README section (#19) #22 Docs: show a direct launch for captures and scripted input, +17/−1

The one thing #15 and #22 do not cover

$?-guarded exit code. #15 reads $LASTEXITCODE after the pipeline, which is right for a child that ran and failed. A command that cannot be started at all leaves $LASTEXITCODE untouched, so it reports the previous command's value — and #3's own reproduction is .\target\release\victory.exe run $missing, which is that case whenever -Exe does not resolve.

$code = if ($?) { $LASTEXITCODE } else { 1 }   # this PR
$code = $LASTEXITCODE                          # #15

With #17 (-Exe resolution, and it exits 1 when nothing is found) and #53 (directory errors) merged, that window closes from the other side, so #15 alone is fine. Noting it rather than asking for a change.

What I verified, in case it helps whoever reviews #15

Windows 11, Rust 1.98.1 (pinned), release build, no game files:

play.ps1 -Game <missing exe> -Exe <the built one>   -> 1   (was 0)
play.ps1 -Game <missing exe> -Exe <not there>       -> 1

And the switches, probed inside the script right after the clearing step, before I saw #22:

(none)              CAPTURE= FRAMES= DUMP= KEYS=
-Capture            CAPTURE=set FRAMES=set DUMP=set KEYS=
-Keys               CAPTURE= FRAMES= DUMP= KEYS=set
-KeepScriptedInput  CAPTURE=set FRAMES=set DUMP=set KEYS=set

Also: #4 does not reproduce on 90b529f

I ran a path with spaces through the launcher and compared it against a direct run:

direct:      victory.exe run "…\GTA 6\game scarlett master.exe" --execute
                 -> Error: malformed image: Could not read file magic
via launcher: play.ps1 -Game "…\GTA 6\game scarlett master.exe"
                 -> the same line, not "reading …\GTA"

Both reach victory.exe with the same argument, so the truncation in #4 is the -Exe default rather than argument splitting — which is what that thread concluded and what #17 fixes. Worth saying so on #4 once #17 lands.

Sorry for the duplicate. #100 (opcode coverage) is the one from me that is not already in flight.

<!-- greyfinch-sync:Zettrox/ztrx:issue:6603419102 --> Imported from [Zettrox/ztrx](https://github.com/Zettrox/ztrx/pull/101). Originally posted by [xiaotu030202](https://github.com/xiaotu030202) on 2026-11-25T11:26:04Z. --- Closing this: #15 and #22 already do both halves, more precisely, and I did not check the open pull requests before writing it. | what this PR did | already in flight | |---|---| | exit with the child's code (#3) | **#15** `Launcher: propagate the native process exit code`, +3/−1 | | `-Capture` / `-Keys` switches + README section (#19) | **#22** `Docs: show a direct launch for captures and scripted input`, +17/−1 | ## The one thing #15 and #22 do not cover `$?`-guarded exit code. #15 reads `$LASTEXITCODE` after the pipeline, which is right for a child that ran and failed. A command that cannot be **started at all** leaves `$LASTEXITCODE` untouched, so it reports the previous command's value — and #3's own reproduction is `.\target\release\victory.exe run $missing`, which is that case whenever `-Exe` does not resolve. ```powershell $code = if ($?) { $LASTEXITCODE } else { 1 } # this PR $code = $LASTEXITCODE # #15 ``` With #17 (`-Exe` resolution, and it exits 1 when nothing is found) and #53 (directory errors) merged, that window closes from the other side, so #15 alone is fine. Noting it rather than asking for a change. ## What I verified, in case it helps whoever reviews #15 Windows 11, Rust 1.98.1 (pinned), release build, no game files: ``` play.ps1 -Game <missing exe> -Exe <the built one> -> 1 (was 0) play.ps1 -Game <missing exe> -Exe <not there> -> 1 ``` And the switches, probed inside the script right after the clearing step, before I saw #22: ``` (none) CAPTURE= FRAMES= DUMP= KEYS= -Capture CAPTURE=set FRAMES=set DUMP=set KEYS= -Keys CAPTURE= FRAMES= DUMP= KEYS=set -KeepScriptedInput CAPTURE=set FRAMES=set DUMP=set KEYS=set ``` ## Also: #4 does not reproduce on `90b529f` I ran a path with spaces through the launcher and compared it against a direct run: ``` direct: victory.exe run "…\GTA 6\game scarlett master.exe" --execute -> Error: malformed image: Could not read file magic via launcher: play.ps1 -Game "…\GTA 6\game scarlett master.exe" -> the same line, not "reading …\GTA" ``` Both reach `victory.exe` with the same argument, so the truncation in #4 is the `-Exe` default rather than argument splitting — which is what that thread concluded and what #17 fixes. Worth saying so on #4 once #17 lands. Sorry for the duplicate. #100 (opcode coverage) is the one from me that is not already in flight.
upstream-sync closed this pull request 2026-11-25 12:07:09 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Zettrox/ztrx!101
No description provided.