lancer_victory.ps1 dies on benign cargo stderr warnings under Windows PowerShell 5.1 when stderr is redirected #233

Closed
opened 2026-11-26 05:39:03 +00:00 by github-bot · 0 comments
Owner

@⁠PeppeBeard on GitHub · 2026-11-25 20:09 UTC · original

Summary

tools/lancer_victory.ps1 terminates during the cargo build step under Windows PowerShell 5.1 when stderr is redirected (2> victory.log), even though nothing has failed. The same command runs fine under PowerShell 7 (pwsh).

Environment

  • Windows 11, build 10.0.26200
  • Windows PowerShell 5.1 (stock powershell.exe) → fails
  • PowerShell 7 (pwsh) → works
  • Current main of this repository, built 2026-11-25
  • Rust 1.100.0 (stable-msvc, freshly installed)

Reproduction

Following the documented measurement workflow from docs/running-gta6.md:

.\tools\lancer_victory.ps1 -GameDir <folder> 2> victory.log

under powershell.exe (5.1), with the VIctory build not yet current (so cargo emits output). Output:

Building VIctory (diag profile, diagnostics feature)...
cargo.exe : warning: use of deprecated method `std::sync::atomic::Atomic::<u64>::fetch_update`: renamed to `try_update` for consistency
At D:\AnyXboxX\tools\lancer_victory.ps1:81 char:1
+ & cargo build --profile diag -p victory --features diagnostics --mani ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (warning: use of...for consistency:String) [], RemoteException
    + FullyQualifiedRoleId: NativeCommandError

(The FullyQualifiedErrorId above is paraphrased from my console; the mechanism is the part that matters.)

Running the same command under pwsh instead succeeds; the diag profile build (victory.exe) completes and lands in third_party\victory\target\diag\.

Root cause (as I understand it)

  1. The script sets $ErrorActionPreference = 'Stop' at the top.
  2. Under Windows PowerShell 5.1, when a native command's stderr is redirected (2>), PowerShell wraps each stderr line into an ErrorRecord (NativeCommandError).
  3. cargo writes a benign warning to stderr (here: a deprecation notice coming from third_party/tombox code, fetch_update → try_update, triggered by the new Rust 1.100).
  4. The script's $ErrorActionPreference = 'Stop' promotes that record into a terminating error at the & cargo build line — before the game ever starts.

So it is nondeterministic from the user's point of view: it only fires when cargo happens to emit stderr output, which depends on toolchain version and warnings present. Same command can pass one day and die the next.

Suggested fix directions

  • Wrap the cargo invocation so its stderr is captured rather than streamed through the redirected stream (e.g. cmd /c "cargo build ... 2>&1"), or
  • Temporarily relax $ErrorActionPreference around the native calls in the script, or
  • Document pwsh as the required shell in docs/running-gta6.md until the script handles 5.1.

Happy to test a patch on 5.1 and 7 if useful — the repro here is 100% on demand.

**@⁠PeppeBeard** on GitHub · 2026-11-25 20:09 UTC · [original](https://github.com/LooperSalty/AnyXboxX/issues/233) ## Summary `tools/lancer_victory.ps1` terminates during the cargo build step under **Windows PowerShell 5.1** when stderr is redirected (`2> victory.log`), even though nothing has failed. The same command runs fine under **PowerShell 7 (pwsh)**. ## Environment - Windows 11, build 10.0.26200 - Windows PowerShell 5.1 (stock `powershell.exe`) → fails - PowerShell 7 (`pwsh`) → works - Current `main` of this repository, built 2026-11-25 - Rust 1.100.0 (stable-msvc, freshly installed) ## Reproduction Following the documented measurement workflow from `docs/running-gta6.md`: ```powershell .\tools\lancer_victory.ps1 -GameDir <folder> 2> victory.log ``` under `powershell.exe` (5.1), with the VIctory build not yet current (so cargo emits output). Output: ``` Building VIctory (diag profile, diagnostics feature)... cargo.exe : warning: use of deprecated method `std::sync::atomic::Atomic::<u64>::fetch_update`: renamed to `try_update` for consistency At D:\AnyXboxX\tools\lancer_victory.ps1:81 char:1 + & cargo build --profile diag -p victory --features diagnostics --mani ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (warning: use of...for consistency:String) [], RemoteException + FullyQualifiedRoleId: NativeCommandError ``` (The `FullyQualifiedErrorId` above is paraphrased from my console; the mechanism is the part that matters.) Running the same command under `pwsh` instead succeeds; the diag profile build (`victory.exe`) completes and lands in `third_party\victory\target\diag\`. ## Root cause (as I understand it) 1. The script sets `$ErrorActionPreference = 'Stop'` at the top. 2. Under Windows PowerShell 5.1, when a native command's stderr is redirected (`2>`), PowerShell wraps each stderr line into an `ErrorRecord` (`NativeCommandError`). 3. `cargo` writes a benign warning to stderr (here: a deprecation notice coming from third_party/tombox code, `fetch_update` → `try_update`, triggered by the new Rust 1.100). 4. The script's `$ErrorActionPreference = 'Stop'` promotes that record into a terminating error at the `& cargo build` line — before the game ever starts. So it is nondeterministic from the user's point of view: it only fires when cargo happens to emit stderr output, which depends on toolchain version and warnings present. Same command can pass one day and die the next. ## Suggested fix directions - Wrap the cargo invocation so its stderr is captured rather than streamed through the redirected stream (e.g. `cmd /c "cargo build ... 2>&1"`), or - Temporarily relax `$ErrorActionPreference` around the native calls in the script, or - Document `pwsh` as the required shell in `docs/running-gta6.md` until the script handles 5.1. Happy to test a patch on 5.1 and 7 if useful — the repro here is 100% on demand.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:39:03 +00:00
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/LooperSalty--AnyXboxX#233
No description provided.