Update to signal-hook 0.3.8, signal-hook-mio 0.2.1 (#558)

This commit is contained in:
Erick Tryzelaar 2021-05-05 06:59:09 -07:00 committed by GitHub
parent 8a3105a68b
commit 576990cb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -56,7 +56,8 @@ crossterm_winapi = "0.7.0"
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
libc = "0.2" libc = "0.2"
mio = { version="0.7", features=["os-poll"] } mio = { version="0.7", features=["os-poll"] }
signal-hook = { version = "0.1.17", features = ["mio-0_7-support"] } signal-hook = { version = "0.3.8" }
signal-hook-mio = { version = "0.2.1", features = ["support-v0_7"] }
# #
# Dev dependencies (examples, ...) # Dev dependencies (examples, ...)

View File

@ -1,7 +1,7 @@
use std::{collections::VecDeque, io, time::Duration}; use std::{collections::VecDeque, io, time::Duration};
use mio::{unix::SourceFd, Events, Interest, Poll, Token}; use mio::{unix::SourceFd, Events, Interest, Poll, Token};
use signal_hook::iterator::Signals; use signal_hook_mio::v0_7::Signals;
use crate::Result; use crate::Result;
@ -52,7 +52,7 @@ impl UnixInternalEventSource {
let mut tty_ev = SourceFd(&tty_raw_fd); let mut tty_ev = SourceFd(&tty_raw_fd);
registry.register(&mut tty_ev, TTY_TOKEN, Interest::READABLE)?; registry.register(&mut tty_ev, TTY_TOKEN, Interest::READABLE)?;
let mut signals = Signals::new(&[signal_hook::SIGWINCH])?; let mut signals = Signals::new(&[signal_hook::consts::SIGWINCH])?;
registry.register(&mut signals, SIGNAL_TOKEN, Interest::READABLE)?; registry.register(&mut signals, SIGNAL_TOKEN, Interest::READABLE)?;
#[cfg(feature = "event-stream")] #[cfg(feature = "event-stream")]
@ -127,9 +127,9 @@ impl EventSource for UnixInternalEventSource {
} }
} }
SIGNAL_TOKEN => { SIGNAL_TOKEN => {
for signal in &self.signals { for signal in self.signals.pending() {
match signal as libc::c_int { match signal {
signal_hook::SIGWINCH => { signal_hook::consts::SIGWINCH => {
// TODO Should we remove tput? // TODO Should we remove tput?
// //
// This can take a really long time, because terminal::size can // This can take a really long time, because terminal::size can