Skip to content

fix: add Windows support — named pipe transport, auth, and encoding - #42

Merged
abruption merged 4 commits into
mainfrom
fix/windows-compat
Sep 8, 2026
Merged

abruption merged 4 commits into
mainfrom
fix/windows-compat

Conversation

@abruption

Copy link
Copy Markdown
Owner

Closes #22

Summary

Native Windows에서 cc-peer의 list와 send가 동작하도록 지원합니다.

Changes

cc_peer.py

  • pid_alive(): Windows에서 ctypes.windll.kernel32.OpenProcess() 사용 (os.kill(pid, 0)은 Windows에서 동작하지 않음)
  • discover(): named pipe 경로(\\.\pipe\) 인식
  • _post_to_pipe(): 신규 — .key 파일에서 auth 토큰을 읽어 auth line 전송 후 메시지 전송
  • post_to_socket(): Windows pipe 감지 시 _post_to_pipe()로 분기
  • 인코딩: 모든 text=True → encoding="utf-8", read_text(encoding="utf-8") 명시, main()에서 stdout/stderr reconfigure

README.md

  • "Linux and macOS only" 제거, Windows 지원 안내로 교체
  • Verified 섹션에 Windows 실기 테스트 결과 추가

SKILL.md

  • Windows 관련 트러블슈팅 2행 추가

Verified

Windows 10 22H2, Python 3.10.0, Claude Code v2.1.263에서 실기 테스트:

기능 결과
list (named pipe 인식) ✅
list --json ✅
send (named pipe + auth) ✅
send --dry-run / --json ✅
update --check ✅
list --host (Windows → Linux) ✅
send --host --dry-run ✅

기존 57개 테스트 전부 통과 (macOS/Linux 미파손).

- pid_alive(): use ctypes OpenProcess on Windows instead of os.kill(pid, 0)
- discover(): recognise named pipe paths as valid inboxes
- post_to_socket(): route Windows pipes to _post_to_pipe(), which reads
  the .key file and sends the mandatory auth line before the message
- All subprocess.run calls use encoding='utf-8' instead of text=True
  to avoid cp949 decode/encode crashes on non-English Windows
- All read_text() calls specify encoding='utf-8'
- main() reconfigures stdout/stderr to utf-8 on Windows

Verified on Windows 10 22H2, Python 3.10, Claude Code v2.1.263:
list, list --json, send (named pipe + auth), send --dry-run,
send --json, update --check, list --host, send --host --dry-run
all pass.
- README: replace 'Linux and macOS only' with Windows support note,
  add Windows to Verified section with named pipe details
- SKILL.md: add Windows-specific troubleshooting rows
Use str(resolved) instead of the POSIX literal so the assertion
matches the platform's native separator.
@abruption
abruption merged commit 7ccc1e7 into main Sep 8, 2026
8 checks passed
@abruption
abruption deleted the fix/windows-compat branch September 8, 2026 23:52
@abruption abruption mentioned this pull request Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support native Windows

1 participant