Fix writeToFile -1700 type coercion error on file close#25
Open
weijianfan wants to merge 1 commit intostorizzi:mainfrom
Open
Fix writeToFile -1700 type coercion error on file close#25weijianfan wants to merge 1 commit intostorizzi:mainfrom
weijianfan wants to merge 1 commit intostorizzi:mainfrom
Conversation
|
Why is this PR diff in an opaque binary blob format that cannot be reviewed when the original file itself can be read as plain text? There are way too many supply chain attacks going on these days that fall though the OSS review process cracks because of binary blobs. Ironically, Claude Code itself calls this suspicious and here is it's suggestion: |
|
Also, from the description alone(since I cannot see source code), it seems my PR raised before at least partly does the same thing. |
Use Foundation NSString writeToFile: as the primary write method to avoid the -1700 type coercion error that occurs when calling `close access` on a file descriptor. Add a safe AppleScript fallback that tracks the file descriptor and only calls `close access` when the file was successfully opened. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
06853d2 to
68818d1
Compare
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.
Summary
close accesswas called without an argument, causing AppleScript to close "current application" instead of the file descriptor, resulting in a-1700type coercion errorclose access→close access fileDescriptorset eof of fileDescriptor to 0before writing to cleanly truncate existing filesprintfif AppleScript file access failsdo shell script "touch ..."beforeopen for accessto ensure the file exists upfrontTest plan
-1700error🤖 Generated with Claude Code