Launcher: the game writes its log itself, not through a PowerShell pipe (a log line held the thread that wrote it) #169

Closed
wasonidas wants to merge 0 commits from upstream-pr/169 into main
wasonidas commented 2026-11-27 19:09:59 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by wasonidas on 2026-11-27T19:09:59Z.


Launcher only (scripts/play-foxhound.ps1); no Rust changes.

Problem

The launcher starts the game as victory run ... 2>&1 | ForEach-Object { ... }: the game's stderr is a pipe, and the PowerShell window takes it line by line to write the log and show it. Rust's stderr has no buffer, so every log line is a write that the thread that logs waits for, a frame's own thread among them, until PowerShell has read it.

Without the game (a program writing 400 lines to stderr): through a PowerShell reader slowed on purpose to 5 ms a line, the longest write took 94.7 ms and 66 of the 400 took over 10 ms. With stderr redirected to a file the longest took 4 ms and none took over 10 ms.

Change

  • cmd's redirection hands the game the log file (>>log 2>&1), so the game writes its log itself. The window shows the file as it grows, from a reader that shares the file and that the game never waits for (it looks every 250 ms).
  • The game's exit code is left in $LASTEXITCODE, as after & $victory run (the F1 menu's restart reads it), and is said when it is not 0. The log's place is said again at the end.
  • The preload's lines go through the pipe as before: nothing draws then.

victory play starts the game itself and is not changed. A path with a % in it (the repository's, the title's or the log's) is not for cmd; the script's comment says so.

Measured

  • RTX 5080, Ryzen 7 9800X3D, 32 GB, Series X profile, release build, -Fps 30: a 200 s start with this launcher block. The game wrote its log itself (4.5 MB), the window showed it as it grew, the exit code and the log's place came at the end; no device removed, no out-of-memory lines; 23-30 FPS on the meter in the last 60 s (that exe's first run, pipelines cold).
  • No frame-time A/B in the game. Our measured runs use a runner that already redirects the log to a file, so they cannot show the difference; the case for this rests on the test without the game above.

Checks

  • On main (10862a6d). The script parses (PowerShell 5.1). cargo check --workspace --all-targets --locked and cargo test -p xtask (asset policy) pass.
  • The block as it stands in this PR, run against a stand-in for victory.exe (a .cmd in a folder with spaces in its name that writes to stdout and stderr over two seconds, with exit codes 3 and 0): every line shown and in the log, stderr among them, a last line without a newline too, $LASTEXITCODE 3 and 0.
  • Against what ran on the card, this port adds the $LASTEXITCODE line (the F1 restart's check is newer than our branch's base, 9d6300fa) and leaves the preload alone. No GPU run was made on top of current main.

Relation to open PRs

#94 ends the script with exit $LASTEXITCODE after these lines; that still holds with this change, since the code is left there. The two touch the same lines, so whichever lands second needs a rebase.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5531843555 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/169). Originally posted by [wasonidas](https://github.com/wasonidas) on 2026-11-27T19:09:59Z. --- Launcher only (`scripts/play-foxhound.ps1`); no Rust changes. ## Problem The launcher starts the game as `victory run ... 2>&1 | ForEach-Object { ... }`: the game's stderr is a pipe, and the PowerShell window takes it line by line to write the log and show it. Rust's stderr has no buffer, so every log line is a write that the thread that logs waits for, a frame's own thread among them, until PowerShell has read it. Without the game (a program writing 400 lines to stderr): through a PowerShell reader slowed on purpose to 5 ms a line, the longest write took 94.7 ms and 66 of the 400 took over 10 ms. With stderr redirected to a file the longest took 4 ms and none took over 10 ms. ## Change - `cmd`'s redirection hands the game the log file (`>>log 2>&1`), so the game writes its log itself. The window shows the file as it grows, from a reader that shares the file and that the game never waits for (it looks every 250 ms). - The game's exit code is left in `$LASTEXITCODE`, as after `& $victory run` (the F1 menu's restart reads it), and is said when it is not 0. The log's place is said again at the end. - The preload's lines go through the pipe as before: nothing draws then. `victory play` starts the game itself and is not changed. A path with a `%` in it (the repository's, the title's or the log's) is not for `cmd`; the script's comment says so. ## Measured - RTX 5080, Ryzen 7 9800X3D, 32 GB, Series X profile, release build, `-Fps 30`: a 200 s start with this launcher block. The game wrote its log itself (4.5 MB), the window showed it as it grew, the exit code and the log's place came at the end; no device removed, no out-of-memory lines; 23-30 FPS on the meter in the last 60 s (that exe's first run, pipelines cold). - **No frame-time A/B in the game.** Our measured runs use a runner that already redirects the log to a file, so they cannot show the difference; the case for this rests on the test without the game above. ## Checks - On `main` (`10862a6d`). The script parses (PowerShell 5.1). `cargo check --workspace --all-targets --locked` and `cargo test -p xtask` (asset policy) pass. - The block as it stands in this PR, run against a stand-in for `victory.exe` (a `.cmd` in a folder with spaces in its name that writes to stdout and stderr over two seconds, with exit codes 3 and 0): every line shown and in the log, stderr among them, a last line without a newline too, `$LASTEXITCODE` 3 and 0. - Against what ran on the card, this port adds the `$LASTEXITCODE` line (the F1 restart's check is newer than our branch's base, `9d6300fa`) and leaves the preload alone. No GPU run was made on top of current `main`. ## Relation to open PRs #94 ends the script with `exit $LASTEXITCODE` after these lines; that still holds with this change, since the code is left there. The two touch the same lines, so whichever lands second needs a rebase.
trustno1-coder commented 2026-11-28 19:23:42 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T19:23:42Z.


Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244511268 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/169#issuecomment-7244511268). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T19:23:42Z. --- Thanks for this. I'm closing it without merging because it conflicts with the current main in several places (main has moved a lot since it was opened, with about 100 pull requests merged today), and I can't resolve that safely on your behalf. If you'd still like it in, please rebase it on the current main and open a new pull request.

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
trustno1-coder/VIctory-NVIDIA!169
No description provided.