Skip to content

Conversation

ajpallares
Copy link
Member

Fixes #5667

Motivation

The FileHandler append(line:) method was using an older API that would produce a crash when writing to the file fails (e.g. not enough disk space available) instead of throwing an error. See https://developer.apple.com/documentation/foundation/filehandle/write(_:).

Description

This PR changes it to use the newer FileHandle's write(contentsOf:) API

@ajpallares ajpallares requested a review from a team as a code owner October 17, 2025 11:57
@ajpallares ajpallares added the pr:fix A bug fix label Oct 17, 2025
Copy link

emerge-tools bot commented Oct 17, 2025

📸 Snapshot Test

76 modified, 799 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester.mac-catalyst-optimized-for-mac
0 0 0 0 236 0 N/A
RevenueCat
com.revenuecat.PaywallsTester.mac-catalyst-scaled-to-match-ipad
0 0 68 0 168 0 ✅ Approved
RevenueCat
com.revenuecat.PaywallsTester.mac-native
0 0 8 0 159 0 ✅ Approved
RevenueCat
com.revenuecat.PaywallsTester
0 0 0 0 236 0 N/A

🛸 Powered by Emerge Tools

Copy link
Contributor

@rickvdl rickvdl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, great improvements 🙌

Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nitpick but looks great!

Copy link
Member

@JayShortway JayShortway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! 😗👌 Just a suggestion/question.

func append(line: String) throws {
RCTestAssertNotMainThread()

self.fileHandle.seekToEndOfFile()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also seekToEnd(), which is maybe newer? I genuinely don't know haha.

Suggested change
self.fileHandle.seekToEndOfFile()
self.fileHandle.seekToEnd()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, great catch! Thank you! Done in f16e0b9

@ajpallares ajpallares merged commit 3038d8d into main Oct 19, 2025
12 checks passed
@ajpallares ajpallares deleted the fix-file-handlers-crash branch October 19, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 FileHandler actor's append(line:) method crashes on some devices

4 participants