Skip to content

fix(claude-code): make fcntl import conditional for Windows compatibility#694

Merged
nicoloboschi merged 1 commit intomainfrom
fix/windows-compatibility
Mar 25, 2026
Merged

fix(claude-code): make fcntl import conditional for Windows compatibility#694
nicoloboschi merged 1 commit intomainfrom
fix/windows-compatibility

Conversation

@benfrank241
Copy link
Contributor

Summary

  • fcntl is a Unix-only module — importing it unconditionally causes an ImportError on Windows, crashing the entire plugin at startup
  • Guards the import with sys.platform != "win32" and sets fcntl = None on Windows
  • increment_turn_count() now skips the flock path when fcntl is None, falling back directly to the lockless read-modify-write (the same fallback that already existed for OSError)
  • No behaviour change on macOS/Linux

Test plan

  • Verify plugin scripts import cleanly on a Windows Python environment (python -c "from lib.state import increment_turn_count")
  • Run existing tests on macOS/Linux to confirm no regression
  • Confirm turn counting still works correctly on Unix (flock path exercised)

🤖 Generated with Claude Code

…lity

fcntl is a Unix-only module — importing it unconditionally causes an
ImportError on Windows, breaking the entire plugin. Guard the import with a
sys.platform check and fall back to a no-op lock path in
increment_turn_count() so Windows users get correct behaviour without
crashing.
@nicoloboschi nicoloboschi merged commit a94a90e into main Mar 25, 2026
32 of 33 checks passed
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.

2 participants