From 1625939dd2a15d5cf668158752486004880b692b Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Wed, 21 Aug 2024 12:03:44 -0700 Subject: [PATCH] Ignore signal interruptions when waiting for epoll in x11 watcher (fixes #31) Signed-off-by: Alex Saveau --- x11/src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/x11/src/main.rs b/x11/src/main.rs index 9ff6385..18d63ce 100644 --- a/x11/src/main.rs +++ b/x11/src/main.rs @@ -32,7 +32,7 @@ use ringboard_sdk::{ use rustix::{ event::epoll, fs::{memfd_create, openat, MemfdFlags, Mode, OFlags, CWD}, - io::read_uninit, + io::{read_uninit, Errno}, net::{ recvmsg, RecvAncillaryBuffer, RecvAncillaryMessage::ScmRights, RecvFlags, SocketAddrUnix, SocketType, @@ -418,8 +418,10 @@ fn run() -> Result<(), CliError> { conn.flush()?; trace!("Waiting for event."); - epoll::wait(&epoll, &mut epoll_events, -1) - .map_io_err(|| "Failed to wait for epoll events.")?; + match epoll::wait(&epoll, &mut epoll_events, -1) { + Err(Errno::INTR) => continue, + r => r.map_io_err(|| "Failed to wait for epoll events.")?, + }; for epoll::Event { flags: _, data } in &epoll_events { match data.u64() {