diff options
Diffstat (limited to 'alacritty_terminal/src/event_loop.rs')
-rw-r--r-- | alacritty_terminal/src/event_loop.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/alacritty_terminal/src/event_loop.rs b/alacritty_terminal/src/event_loop.rs index 57045f4a..42025b00 100644 --- a/alacritty_terminal/src/event_loop.rs +++ b/alacritty_terminal/src/event_loop.rs @@ -67,10 +67,11 @@ where pty: T, hold: bool, ref_test: bool, - ) -> EventLoop<T, U> { + ) -> io::Result<EventLoop<T, U>> { let (tx, rx) = mpsc::channel(); - EventLoop { - poll: polling::Poller::new().expect("create Poll").into(), + let poll = polling::Poller::new()?.into(); + Ok(EventLoop { + poll, pty, tx, rx: PeekableReceiver::new(rx), @@ -78,7 +79,7 @@ where event_proxy, hold, ref_test, - } + }) } pub fn channel(&self) -> EventLoopSender { @@ -213,8 +214,9 @@ where let mut interest = PollingEvent::readable(0); // Register TTY through EventedRW interface. - unsafe { - self.pty.register(&self.poll, interest, poll_opts).unwrap(); + if let Err(err) = unsafe { self.pty.register(&self.poll, interest, poll_opts) } { + error!("Event loop registration error: {}", err); + return (self, state); } let mut events = Events::with_capacity(NonZeroUsize::new(1024).unwrap()); @@ -235,7 +237,10 @@ where if let Err(err) = self.poll.wait(&mut events, timeout) { match err.kind() { ErrorKind::Interrupted => continue, - _ => panic!("EventLoop polling error: {err:?}"), + _ => { + error!("Event loop polling error: {}", err); + break 'event_loop; + }, } } |