terminal: remove unwrap() from get_events() loop

When exiting the app, the received value might be None.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/386/head
Manos Pitsidianakis 4 weeks ago
parent 46e40856ba
commit b5ddc397df
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -215,9 +215,10 @@ enum InputMode {
Paste(Vec<u8>), Paste(Vec<u8>),
} }
#[derive(Debug)] #[derive(Debug, Default)]
/// Main process sends commands to the input thread. /// Main process sends commands to the input thread.
pub enum InputCommand { pub enum InputCommand {
#[default]
/// Exit thread /// Exit thread
Kill, Kill,
} }
@ -303,7 +304,7 @@ pub fn get_events(
continue 'poll_while; continue 'poll_while;
}; };
let _ = nix::unistd::read(new_command_fd.as_raw_fd(), buf.as_mut()); let _ = nix::unistd::read(new_command_fd.as_raw_fd(), buf.as_mut());
match cmd.unwrap() { match cmd.unwrap_or_default() {
InputCommand::Kill => return, InputCommand::Kill => return,
} }
} }

Loading…
Cancel
Save