…dard handles to anyps5.log
A --windows-gui build started from Explorer, or any Windows executable
started without a standard output or error handle, lost everything it
printed: the entry stub's messages, the libraries' stdout and stderr,
uncaught exception messages and crash reports.
Before it enters its directory or loads a library, the entry stub now
checks the standard output and error handles, and gives each missing one
anyps5.log beside the executable. The C runtime of the libraries it then
loads adopts the file. Executables started with handles are unchanged,
and one that cannot create the file starts as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
A Windows executable started without stdout or stderr handles had nowhere to send its startup and failure messages. The entry stub now checks both handles before loading host libraries. It sends each missing stream to
anyps5.logbeside the executable; both missing streams share the file. Existing handles are preserved, each run replaces the previous log, and a file-creation failure leaves startup unchanged.The implementation commit retains Doston Abdullayev's authorship. The documentation note in
docs/user/USAGE.mdis under the Windows runtime launch instructions, separate from the controller input section. That placement also avoids the insertion overlap with #3998.Closes #3282
Tested
Current branch HEAD:
b390831a5808666b39f2899cc5b19575a0ee38d5on pinned main5fe4bebec60ae1295aea301be28def2019b332ae.relinker,windows_stdio_host_ucrt, andwindows_stdio_host_msvcrtwithcmake --build C:/Users/admin/anyps5-build-3282 --target relinker windows_stdio_host_ucrt windows_stdio_host_msvcrt --parallel 1, then completed the full build withcmake --build C:/Users/admin/anyps5-build-3282 --parallel 1.ctest --test-dir C:/Users/admin/anyps5-build-3282 -R "^windows_import_modules$" -V: 1/1 passed. The test exercises actual UCRT and MSVCRT DLL fixtures, missing stdout and/or stderr, and both redirected handles; it validates MSVCRT imports__iob_funcandfputsdirectly frommsvcrt.dlland rejects API-set CRT imports.ctest --test-dir C:/Users/admin/anyps5-build-3282 --output-on-failure: 121/121 passed, 0 failed, 0 skipped (53.12 seconds).python -I tools/check_conventions.py --base 5fe4bebec60ae1295aea301be28def2019b332ae --head HEAD: passed.git diff --check 5fe4bebec60ae1295aea301be28def2019b332ae...HEAD: clean.885fa1c0a43c0c7c6bdb3a8a9d2e6f87c28ccff8.The red-green verification (failing without the logging code, passing with it restored) is historical, from the prior base
5aaf26bd325607f65bde28741a4e82ceaaf586c0; it was not rerun on this rebase. No Wine, Explorer launch, or full title/gameplay test. Upstream GitHub CI was not dispatched: our upstream permission is read-only (pull), while dispatch requires write, maintain, or admin permission.Checklist
mainsnapshot used for review/build (5fe4bebec60ae1295aea301be28def2019b332ae). GitHub's currentmainhas since advanced tod146ec1b667c3e34bebf817efcc094bdac393423; PR fix(relinker): log Windows output when standard handles are missing #4062 currently reports mergeable, and this branch was not rebased/tested against that later commit. No other open PR implements the missing-standard-handle fallback. feat(tools): add a graphical launcher #3786 captures output from processes its graphical launcher starts, using pipes andlast_run.log; it does not provide this fallback for direct launches without handles. fix(relinker): preserve load failures of present optional providers #3579 composes cleanly, and the feat(pad): queue timed controller button sequences #3998 documentation overlap is resolved.NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)