fix: defer kitty debug-log Close#909
Merged
andrinoff merged 1 commit intofloatpane:masterfrom Apr 26, 2026
Merged
Conversation
fetcher/fetcher.go opened the DEBUG_KITTY_LOG file and then called f.WriteString / f.Close inline, so a panic between open and close (or during WriteString) would leak the file descriptor. Wrap the open-write-close in a closure with 'defer f.Close()' so the handle always returns, even under panic. Only the kitty-img debug branch is touched; the long-lived getDebugIMAPWriter handle at line 45 is intentional and left alone. Fixes floatpane#894 Signed-off-by: SAY-5 <[email protected]>
floatpanebot
previously requested changes
Apr 24, 2026
Member
floatpanebot
left a comment
There was a problem hiding this comment.
Hi @SAY-5! Please fix the following issues with your PR:
- Title: Is too long (64 characters). The PR title must be strictly under 40 characters.
- Body: Missing the
## What?or## Why?headings required by the PR template.
floatpanebot
previously requested changes
Apr 25, 2026
Member
floatpanebot
left a comment
There was a problem hiding this comment.
Hi @SAY-5! Please fix the following issues with your PR:
- Title: Is too long (41 characters). The PR title must be strictly under 40 characters.
Formatting issues have been resolved. Thank you!
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.
What?
Wrap open/write/close of the
DEBUG_KITTY_LOGfile infetcher/fetcher.goin a closure withdefer f.Close()so the file descriptor is always released, even ifWriteStringpanics or returns mid-call.Why?
The original
OpenFile->WriteString->Closesequence was inline. A panic (or any non-local exit) betweenOpenFileandCloseleaked the descriptor. The long-livedgetDebugIMAPWriterhandle atfetcher.go:45stays as-is (intentional, stored on the package-leveldebugIMAPFile).Fixes #894.
Test plan
go build ./...go vet ./fetcher/...