-
fix(cli): unbreak claude-tap on Windows (#83) (#84)
发布于
2026-04-28 16:58:24 +00:00 - fix(cli): unbreak claude-tap on Windows (#83)
Three independent Windows-only failures all surfaced at startup:
signal.SIGTSTPis Unix-only — accessing the attribute raised
AttributeErrorbefore any signal handler ever fired. Guard the
attribute lookup so Windows sessions skip the SIGTSTP wiring.asyncio.create_subprocess_exec("claude", ...)callsCreateProcess,
which only auto-appends.exe; npm-installed shims land as
claude.cmdand producedFileNotFoundError [WinError 2]. Resolve
the command viashutil.which()and pass the absolute path so
.cmd/.batshims work the same as.exebinaries.- Default Windows console encoding (GBK/cp936) cannot encode the emoji
used in our progress prints, raisingUnicodeEncodeErroron the very
firstprint. Reconfigure stdout/stderr to UTF-8 with
errors="backslashreplace"so we never crash on non-UTF-8 consoles.
Adds
tests/test_windows_compat.pywith platform-agnostic regressions
that simulate Windows by removingsignal.SIGTSTPand stubbing
shutil.which, and updatestest_codex_launch.pyfor the new
resolved-path contract.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
- refactor(cli): tighten Windows-fix comments and drop dead code
- Compress the resolved_cmd rationale comment from three lines to two.
- Inline the display string in the startup print; drop the redundant
display_cmd local and its unnecessary .rstrip() (str.join over a
non-empty list never produces trailing whitespace). - Drop per-test docstrings in test_windows_compat.py — the test names
are self-describing; the module docstring already explains the
cross-platform simulation strategy. - Drop the unused captured dict in the SIGTSTP-absent test.
No behavior change; gates and the 7 targeted tests stay green.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
- fix(cli): finish Windows compat — uv shim, file URI, manifest paths
Three follow-ups to the #83 fix uncovered by a deeper audit:
_start_background_updateinvoked["uv", ...]directly, so the same
CreateProcess-doesn't-resolve-.cmdproblem fromrun_clientwould
silently swallow background upgrades on Windows when uv ships as a
.cmdshim. Resolve viashutil.which("uv")and bail out cleanly
when missing.f"file://{html_path.absolute()}"produced malformed URIs on
Windows (file://C:\path\file.html) and didn't URL-encode spaces.
Replace withPath.as_uri(), which yields RFC 8089-compliant
file:///C:/path/file.htmlon every OS..cloudtap-manifest.jsonstored OS-native separators in trace file
paths, so a.traces/directory synced between Windows and POSIX
(cloud drive, git, rsync) would double-register entries because
2026-04-29/trace.jsonland2026-04-29\trace.jsonlcompared
unequal. Introduce_rel_posix()to write forward slashes
consistently, and normalize backslashes on read so manifests written
by older builds keep matching.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
- fix(scripts,tests): UTF-8 hardening for ancillary files on Windows
scripts/verify_screenshots.pyprinted status with emoji (❌/✅)
on the bareprintstream, so running it on a Windows GBK console
raised UnicodeEncodeError before any check could run. Apply the same
UTF-8 reconfigure pattern used byclaude_tap.cli. Same script also
builtfile://URLs with naked Windows paths — switch toas_uri().tests/test_nav_browser.pyandtests/test_perf_viewer.pyopened
tempfile.NamedTemporaryFilein text mode withoutencoding=, so
they fall back to the locale codec and crash when the viewer
template's I18N block hits a non-encodable codepoint on Chinese
Windows. Make the encoding explicit.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com
下载附件