Skip to content

fix(kitty): dont error on non-existent temporary file after print#87

Closed
hasezoey wants to merge 1 commit into
atanunq:masterfrom
hasezoey:fixKittyTmpError
Closed

fix(kitty): dont error on non-existent temporary file after print#87
hasezoey wants to merge 1 commit into
atanunq:masterfrom
hasezoey:fixKittyTmpError

Conversation

@hasezoey
Copy link
Copy Markdown
Contributor

@hasezoey hasezoey commented Nov 8, 2025

Due to kitty terminals deleting the file after fully reading it in known temporary directories.

This results in kitty to fail "local"(file) protocol with error from viuer "file not found" and falling-back to the "remote" way.

Originally part of #79

@hasezoey hasezoey changed the title fix(kitty): dont error on non-existed temporary file after print fix(kitty): dont error on non-existent temporary file after print Nov 8, 2025
@atanunq
Copy link
Copy Markdown
Owner

atanunq commented Nov 20, 2025

Thank you for catching this! While trying it out I noticed that local printing has a race condition. Sometimes the temp file will be deleted before Kitty attempts to read it. Adding a 10ms delay confirmed that.

I'm wondering whether we can avoid that by first transferring the image and then wait for a response when we display it, described here https://sw.kovidgoyal.net/kitty/graphics-protocol/#display-images-on-screen. I'll give it a shot

@hasezoey
Copy link
Copy Markdown
Contributor Author

hasezoey commented Nov 20, 2025

Sometimes the temp file will be deleted before Kitty attempts to read it. Adding a 10ms delay confirmed that.

FYI, this is the "race condition" i mentioned in #79 (comment) and #90 (comment)

I'm wondering whether we can avoid that by first transferring the image and then wait for a response when we display it, described here https://sw.kovidgoyal.net/kitty/graphics-protocol/#display-images-on-screen. I'll give it a shot

Already done in #90

@atanunq
Copy link
Copy Markdown
Owner

atanunq commented Nov 20, 2025

way ahead of me 🙇

@hasezoey
Copy link
Copy Markdown
Contributor Author

I'm wondering whether we can avoid that by first transferring the image and then wait for a response when we display it, described here https://sw.kovidgoyal.net/kitty/graphics-protocol/#display-images-on-screen. I'll give it a shot
Already done in #90

Just to note, #90 is practically ready to be merged, after this PR (#87) and #85 plus a rebase, so it should be able to be updated & merged quickly right after those are done.

Due to kitty terminals deleting the file after fully reading it in known temporary directories.
@atanunq
Copy link
Copy Markdown
Owner

atanunq commented Nov 26, 2025

Closing as the code is part of #90

@atanunq atanunq closed this Nov 26, 2025
@hasezoey hasezoey deleted the fixKittyTmpError branch November 26, 2025 17:37
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