Commit Graph

2 Commits

Author SHA1 Message Date
a1343528f7 scripts, viewer: a redirected stdout no longer dies on a path outside the code page
Under `python -I` on Windows a redirected stdout is strict ANSI, so printing a path with a character outside the
code page raised UnicodeEncodeError. tools/ guards against it at the start of every __main__ block and
tests/test_tool_stdout_encoding.py enforces that, but only for tools/. viewer/serve.py died before it started
serving and scripts/audit_shader4_regs.py exited 1 after writing its report; bench_wave64.py and run_gpu_tests.py
print the same kind of output unguarded. All four get the guard, and the check now covers scripts/ and viewer/.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
2026-11-22 19:55:36 +03:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +00:00