Replace fcntl with cross-platform portalocker (fix win/powershell errors)#739
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
evantahler
commented
Jan 8, 2026
| and logout identity rotation. | ||
| """ | ||
|
|
||
| import fcntl |
Contributor
Author
There was a problem hiding this comment.
This was the actual problem to solve for windows users
Comment on lines
-94
to
+92
| os.rename(temp_path, self.usage_file_path) | ||
| # Use os.replace() for cross-platform atomic file replacement | ||
| # os.replace() is atomic on both Unix and Windows (Python 3.3+) | ||
| os.replace(temp_path, self.usage_file_path) |
Contributor
Author
There was a problem hiding this comment.
My new test taught me this
pmdroid
approved these changes
Jan 9, 2026
torresmateo
approved these changes
Jan 9, 2026
Comment on lines
-94
to
+92
| os.rename(temp_path, self.usage_file_path) | ||
| # Use os.replace() for cross-platform atomic file replacement | ||
| # os.replace() is atomic on both Unix and Windows (Python 3.3+) | ||
| os.replace(temp_path, self.usage_file_path) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So even importing
fcntlcauses problems on windows. This PR replaces fcntl with portalocker. Tests all pass, so I think we are good.ref: https://arcade-ai.slack.com/archives/C08K1SJ072S/p1767897850450239?thread_ts=1766186586.406019&cid=C08K1SJ072S
Closes ENGTOP-8
Note
Cross-platform file locking
fcntlwithportalockerinarcade_core/usage/identity.py(shared/exclusive locks); switch to atomicos.replace()portalockerdependency and bumparcade-coreto4.2.1Installation/CI
test-install.ymlruns install/CLI checks on macOS, Windows, and Linux for Python 3.10/3.12tests/install/test_install.pyand README to verify install,arcadeCLI availability, andportalockerlocking behaviorWritten by Cursor Bugbot for commit 3fe98fb. This will update automatically on new commits. Configure here.