fix(menu,victory): prevent headless restart stdin deadlocks and clear stale restart exit code #407

Merged
Androtim merged 3 commits from upstream-pr/407 into main 2026-12-03 19:50:48 +00:00
Androtim commented 2026-12-03 19:20:51 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:20:51Z.


Follow-up to #406 addressing both the [P0] and [P1] issues identified in the Gate 2 audit:

Summary

  1. [P0] Prevent invisible stdin deadlocks on headless CREATE_NO_WINDOW restarts:
    • Added interactive_console() (backed by pure testable is_interactive_console + GetConsoleWindow() on Windows) in apps/victory/src/play.rs and replaced all raw std::io::stdin().is_terminal() prompt gates (offer_dlss, offer_fsr, offer_mfg, check_shader_model, hold_window). Interactive prompts are now skipped when VICTORY_NO_CONSOLE=1, when GetConsoleWindow() is null (such as a CREATE_NO_WINDOW windowless console whose CONIN$ still reports is_terminal() == true), or when stdin is not a terminal.
    • Updated the headless branch of restart_command_line in crates/victory-gpu/src/host/menu.rs to pass -NonInteractive to powershell.exe and pipe $null | & '{play}' {args} so child processes receive closed/EOF stdin instead of CONIN$.
  2. [P1] Clear stale VICTORY_RESTART_EXIT_CODE across self-spawned PowerShell restarts:
    • Prepended Remove-Item Env:VICTORY_RESTART_EXIT_CODE -ErrorAction SilentlyContinue; in both console and headless branches of restart_command_line so that after a preload == true self-restart (where the original parent launcher saw exit code 0 and stopped supervising), subsequent restarts in the child session self-relaunch instead of exiting with the stale code into an unsupervised PowerShell host.

Verification

  • cargo test -p victory-gpu --lib host::menu — 8 passed
  • cargo test -p victory — 49 unit + 2 integration passed
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo xtask policy — asset policy: 354 files ok
<!-- greyfinch-sync:Androtim/MiniVI:issue:5633363591 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/407). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T19:20:51Z. --- Follow-up to #406 addressing both the `[P0]` and `[P1]` issues identified in the Gate 2 audit: ### Summary 1. **`[P0]` Prevent invisible stdin deadlocks on headless `CREATE_NO_WINDOW` restarts:** - Added `interactive_console()` (backed by pure testable `is_interactive_console` + `GetConsoleWindow()` on Windows) in `apps/victory/src/play.rs` and replaced all raw `std::io::stdin().is_terminal()` prompt gates (`offer_dlss`, `offer_fsr`, `offer_mfg`, `check_shader_model`, `hold_window`). Interactive prompts are now skipped when `VICTORY_NO_CONSOLE=1`, when `GetConsoleWindow()` is null (such as a `CREATE_NO_WINDOW` windowless console whose `CONIN$` still reports `is_terminal() == true`), or when stdin is not a terminal. - Updated the headless branch of `restart_command_line` in `crates/victory-gpu/src/host/menu.rs` to pass `-NonInteractive` to `powershell.exe` and pipe `$null | & '{play}' {args}` so child processes receive closed/EOF stdin instead of `CONIN$`. 2. **`[P1]` Clear stale `VICTORY_RESTART_EXIT_CODE` across self-spawned PowerShell restarts:** - Prepended `Remove-Item Env:VICTORY_RESTART_EXIT_CODE -ErrorAction SilentlyContinue;` in both console and headless branches of `restart_command_line` so that after a `preload == true` self-restart (where the original parent launcher saw exit code `0` and stopped supervising), subsequent restarts in the child session self-relaunch instead of exiting with the stale code into an unsupervised PowerShell host. ### Verification - `cargo test -p victory-gpu --lib host::menu` — 8 passed - `cargo test -p victory` — 49 unit + 2 integration passed - `cargo clippy --workspace --all-targets -- -D warnings` — clean - `cargo xtask policy` — `asset policy: 354 files ok`
Androtim commented 2026-12-03 19:32:36 +00:00 (Migrated from github.com)

Imported from Androtim/MiniVI. Originally posted by Androtim on 2026-12-03T19:32:36Z.


Read-only full diff audit (4cd20c2d, apps/victory/src/play.rs + crates/victory-gpu/src/host/menu.rs, 100% title-neutral): VERIFIED CLEAN (0 P0/P1). Properly closes both #406 Gate 2 findings (interactive_console() via GetConsoleWindow() + VICTORY_NO_CONSOLE=1, -NonInteractive + $null | & stdin EOF, and clearing VICTORY_RESTART_EXIT_CODE on self-spawned PowerShell restarts) with zero GPU/shader surface touched. Queued for immediate squash-merge as soon as CI check completes green.

<!-- greyfinch-sync:Androtim/MiniVI:comment:7389858306 --> Imported from [Androtim/MiniVI](https://github.com/Androtim/MiniVI/pull/407#issuecomment-7389858306). Originally posted by [Androtim](https://github.com/Androtim) on 2026-12-03T19:32:36Z. --- Read-only full diff audit (`4cd20c2d`, `apps/victory/src/play.rs` + `crates/victory-gpu/src/host/menu.rs`, 100% title-neutral): **VERIFIED CLEAN (0 P0/P1)**. Properly closes both `#406` Gate 2 findings (`interactive_console()` via `GetConsoleWindow()` + `VICTORY_NO_CONSOLE=1`, `-NonInteractive` + `$null | &` stdin EOF, and clearing `VICTORY_RESTART_EXIT_CODE` on self-spawned PowerShell restarts) with zero GPU/shader surface touched. Queued for immediate squash-merge as soon as CI `check` completes green.
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
Androtim/MiniVI!407
No description provided.