mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-17 07:55:42 +00:00
Closes FR-44 Unlike X11, where Zed already times out clipboard reads, on Wayland we had no timeout at all. We read the clipboard from a pipe the source app writes into, and we were doing a blocking `read_to_end` on it. So if the other app opened the pipe but never wrote anything, or stalled partway through, the read would block forever and hang Zed. This PR replaces it with a non-blocking read driven by `poll` with a 4s timeout, so: - a stalled writer fails cleanly instead of freezing us. - a slow writer that's still making progress on a large payload keeps working. This roughly mirrors what the X11 path already does. I have tested pasting text, large image, drag-n-drop, etc cases. To Reproduce: 1. Copy text from a web page in Firefox. 2. `kill -STOP "$(pgrep -o firefox)"` 3. Paste into Zed. Zed hangs indefinitely. <img width="400" src="https://github.com/user-attachments/assets/532d1c55-1500-4143-8227-127e0024efba" /> Release Notes: - Fixed a freeze on Linux Wayland when reading the clipboard from a slow or unresponsive application.