CLI: preserve the title entry point exit status #1593

Merged
AwsAli05 merged 1 commit from upstream-pr/1594 into main 2026-11-25 00:14:51 +00:00
AwsAli05 commented 2026-11-24 19:37:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by AwsAli05 on 2026-11-24T19:37:53Z.


When a title's entry point returns to VIctory, the CLI prints its status and currently exits with zero. That makes a failed boot look successful to scripts that use the process status. Return the title's status through the run command and preserve all 32 bits at the process boundary. A successful bind-only invocation still exits with zero.

Verification

On Windows, I loaded a synthetic PE that imports GetCurrentProcessId and returns 0x80000107 from its entry point. The old release build printed 2147483911 and exited with 0. The patched build returned 0x80000107 (PowerShell reports -2147483385). A second synthetic PE returned 0, and a bind-only run of the nonzero fixture also exited with 0.

The synthetic source was compiled with MinGW-w64 using a custom entry point and no CRT.

__declspec(dllimport) unsigned long GetCurrentProcessId(void);
static unsigned long (*volatile process_id)(void);

unsigned long probe_start(void *unused) {
    process_id = GetCurrentProcessId;
    return process_id() != 0 ? 0x80000107UL : 0;
}
gcc -nostdlib '-Wl,--entry,probe_start' '-Wl,--subsystem,console' -o exit-probe.exe exit-probe.c -lkernel32
victory run (Resolve-Path .\exit-probe.exe) --execute
$LASTEXITCODE

The CLI unit test, formatting check and staged asset policy passed. All inputs were synthetic.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6589873339 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1594). Originally posted by [AwsAli05](https://github.com/AwsAli05) on 2026-11-24T19:37:53Z. --- When a title's entry point returns to VIctory, the CLI prints its status and currently exits with zero. That makes a failed boot look successful to scripts that use the process status. Return the title's status through the run command and preserve all 32 bits at the process boundary. A successful bind-only invocation still exits with zero. ### Verification On Windows, I loaded a synthetic PE that imports GetCurrentProcessId and returns 0x80000107 from its entry point. The old release build printed 2147483911 and exited with 0. The patched build returned 0x80000107 (PowerShell reports -2147483385). A second synthetic PE returned 0, and a bind-only run of the nonzero fixture also exited with 0. The synthetic source was compiled with MinGW-w64 using a custom entry point and no CRT. ```c __declspec(dllimport) unsigned long GetCurrentProcessId(void); static unsigned long (*volatile process_id)(void); unsigned long probe_start(void *unused) { process_id = GetCurrentProcessId; return process_id() != 0 ? 0x80000107UL : 0; } ``` ```powershell gcc -nostdlib '-Wl,--entry,probe_start' '-Wl,--subsystem,console' -o exit-probe.exe exit-probe.c -lkernel32 victory run (Resolve-Path .\exit-probe.exe) --execute $LASTEXITCODE ``` The CLI unit test, formatting check and staged asset policy passed. All inputs were synthetic.
acetonahard-code commented 2026-11-24 23:05:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T22:22:08Z.


Tested on Windows 11 with the repo toolchain, merged into current main (70564ae):

cargo test -p victory passed failed ignored
main 1 0 0
main + this PR 1 0 0
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7146143463 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1594#issuecomment-7146143463). Originally posted by [acetonahard-code](https://github.com/acetonahard-code) on 2026-11-24T22:22:08Z. --- Tested on Windows 11 with the repo toolchain, merged into current `main` (70564ae): | `cargo test -p victory` | passed | failed | ignored | |---|---|---|---| | `main` | 1 | 0 | 0 | | `main` + this PR | 1 | 0 | 0 | - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
upstream-sync closed this pull request 2026-11-25 01:06:55 +00:00
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
Marvisak/VIctory!1593
No description provided.