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

Merged
wasonidas merged 1 commit from upstream-pr/1417 into main 2026-11-29 08:16:56 +00:00
wasonidas commented 2026-11-28 19:27:17 +00:00 (Migrated from github.com)

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


Reopens #169 as asked there: the same change, rebased on the current main (32ecacf). Launcher only (scripts/play-foxhound.ps1, +39/−3); 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 and is said when it is not 0. The log's place is said again at the end.
  • The script still ends with exit $LASTEXITCODE, as #94 made it: whoever calls it gets the title's failure.
  • 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.

The rebase

One conflict, with #94's last lines. Both sides are kept: this PR's block, then exit $LASTEXITCODE.

Measured

  • RTX 5080, Ryzen 7 9800X3D, 32 GB, Series X profile, release build, -Fps 30: a 200 s start with this launcher block, before the rebase. 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.
  • 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.
  • Not run in the game on top of the current main.

Checks, on this rebased commit

  • The script parses (PowerShell 5.1).
  • The resolved block run against a stand-in for victory.exe (a .cmd in a folder with spaces in its name that writes to stdout and stderr): every line shown and in the log, a last line without a newline too, the script's exit codes 3 and 0.
  • cargo check --workspace --all-targets --locked and cargo build --locked -p victory pass.
  • cargo test -p xtask fails on main itself (bindings.ini is not on the policy's allowlist, from 4715a428), and CI's Clippy step fails on main in victory-shader and victory-gpu (shadow.rs:1740). Neither is touched here.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5543789253 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1417). Originally posted by [wasonidas](https://github.com/wasonidas) on 2026-11-28T19:27:17Z. --- Reopens #169 as asked there: the same change, rebased on the current `main` (`32ecacf`). Launcher only (`scripts/play-foxhound.ps1`, +39/−3); 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` and is said when it is not 0. The log's place is said again at the end. - The script still ends with `exit $LASTEXITCODE`, as #94 made it: whoever calls it gets the title's failure. - 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. ## The rebase One conflict, with #94's last lines. Both sides are kept: this PR's block, then `exit $LASTEXITCODE`. ## Measured - RTX 5080, Ryzen 7 9800X3D, 32 GB, Series X profile, release build, `-Fps 30`: a 200 s start with this launcher block, before the rebase. 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. - **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. - **Not run in the game on top of the current `main`.** ## Checks, on this rebased commit - The script parses (PowerShell 5.1). - The resolved block run against a stand-in for `victory.exe` (a `.cmd` in a folder with spaces in its name that writes to stdout and stderr): every line shown and in the log, a last line without a newline too, the script's exit codes 3 and 0. - `cargo check --workspace --all-targets --locked` and `cargo build --locked -p victory` pass. - `cargo test -p xtask` fails on `main` itself (`bindings.ini` is not on the policy's allowlist, from `4715a428`), and CI's Clippy step fails on `main` in `victory-shader` and `victory-gpu` (`shadow.rs:1740`). Neither is touched here.
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!1417
No description provided.