diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-03-08 12:58:51 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-03-08 12:58:51 -0500 |
commit | dcceb025761d379e18111043eb2101e112addb71 (patch) | |
tree | 8b8e7aafc0b5e863749cb2642fc29302657eadea | |
parent | 5dd712dbda2007fe16d9addc2497f72593df7a47 (diff) | |
download | textmode-dcceb025761d379e18111043eb2101e112addb71.tar.gz textmode-dcceb025761d379e18111043eb2101e112addb71.zip |
bump deps
-rw-r--r-- | Cargo.toml | 30 | ||||
-rw-r--r-- | deny.toml | 2 | ||||
-rw-r--r-- | tests/basic.rs | 5 | ||||
-rw-r--r-- | tests/fixtures/mod.rs | 15 | ||||
-rw-r--r-- | tests/input.rs | 4 |
5 files changed, 25 insertions, 31 deletions
@@ -13,28 +13,24 @@ license = "MIT" include = ["src/**/*", "LICENSE", "README.md", "CHANGELOG.md"] [dependencies] -itoa = "1.0.1" -nix = "0.23.1" -terminal_size = "0.1.17" -vt100 = "0.15.1" +itoa = "1.0.6" +nix = "0.26.2" +terminal_size = "0.2.5" +vt100 = "0.15.2" -tokio = { version = "1.17.0", features = ["io-std", "io-util", "rt", "rt-multi-thread"], optional = true } +tokio = { version = "1.26.0", features = ["io-std", "io-util", "rt", "rt-multi-thread"], optional = true } [features] default = [] async = ["tokio"] [dev-dependencies] -assert_cmd = "2.0.4" -assert_fs = "1.0.7" -bytes = "1.1.0" +assert_cmd = "2.0.8" +assert_fs = "1.0.10" +bytes = "1.4.0" escargot = "0.5.7" -futures = "0.3.21" -libc = "0.2.119" -pty-process = { version = "0.2.0", features = ["async"] } -tokio = { version = "1.17.0", features = ["full"] } -tokio-util = { version = "0.7.0", features = ["io"] } - -[patch.crates-io] -nix = { git = "https://github.com/nix-rust/nix" } -pty-process = { git = "https://github.com/doy/pty-process" } +futures = "0.3.26" +libc = "0.2.139" +pty-process = { version = "0.3.0", features = ["async"] } +tokio = { version = "1.26.0", features = ["full"] } +tokio-util = { version = "0.7.7", features = ["io"] } @@ -10,5 +10,5 @@ unsound = "deny" [bans] [licenses] -allow = ["MIT", "Apache-2.0"] +allow = ["MIT", "Apache-2.0", "Unicode-DFS-2016"] copyleft = "deny" diff --git a/tests/basic.rs b/tests/basic.rs index e0856fb..3faac9c 100644 --- a/tests/basic.rs +++ b/tests/basic.rs @@ -1,5 +1,4 @@ use std::io::Write as _; -use std::os::unix::io::AsRawFd as _; mod fixtures; @@ -11,7 +10,7 @@ fn test_basic() { assert_eq!(fixtures::read(pty), b"\x1b[6;6Hfoo"); pty.write_all(b"a").unwrap(); - assert!(!fixtures::read_ready(pty.as_raw_fd())); + assert!(!fixtures::read_ready(&pty)); pty.write_all(b"a").unwrap(); assert_eq!( @@ -32,7 +31,7 @@ fn test_async() { assert_eq!(fixtures::read(pty), b"\x1b[6;6Hfoo"); pty.write_all(b"a").unwrap(); - assert!(!fixtures::read_ready(pty.as_raw_fd())); + assert!(!fixtures::read_ready(&pty)); pty.write_all(b"a").unwrap(); assert_eq!( diff --git a/tests/fixtures/mod.rs b/tests/fixtures/mod.rs index 5a65954..aee5019 100644 --- a/tests/fixtures/mod.rs +++ b/tests/fixtures/mod.rs @@ -74,7 +74,7 @@ impl BuiltFixture { let mut child = cmd.spawn(&pts).unwrap(); if self.screenguard { - assert!(read_ready(pty.as_raw_fd())); + assert!(read_ready(&pty)); let mut buf = vec![0u8; 1024]; let bytes = pty.read(&mut buf).unwrap(); buf.truncate(bytes); @@ -86,7 +86,7 @@ impl BuiltFixture { f(&mut pty); if self.screenguard { - assert!(read_ready(pty.as_raw_fd())); + assert!(read_ready(&pty)); let mut buf = vec![0u8; 1024]; let bytes = pty.read(&mut buf).unwrap(); buf.truncate(bytes); @@ -101,7 +101,7 @@ impl BuiltFixture { #[allow(dead_code)] #[track_caller] pub fn read(f: &mut pty_process::blocking::Pty) -> Vec<u8> { - assert!(read_ready(f.as_raw_fd())); + assert!(read_ready(&f)); let mut buf = vec![0u8; 1024]; let bytes = f.read(&mut buf).unwrap(); buf.truncate(bytes); @@ -113,16 +113,17 @@ pub fn read(f: &mut pty_process::blocking::Pty) -> Vec<u8> { pub fn read_line( f: &mut std::io::BufReader<&mut pty_process::blocking::Pty>, ) -> Vec<u8> { - assert!(!f.buffer().is_empty() || read_ready(f.get_ref().as_raw_fd())); + assert!(!f.buffer().is_empty() || read_ready(f.get_ref())); let mut buf = vec![]; f.read_until(b'\n', &mut buf).unwrap(); buf } #[allow(dead_code)] -pub fn read_ready(fd: std::os::unix::io::RawFd) -> bool { +pub fn read_ready<Fd: std::os::fd::AsFd>(fd: Fd) -> bool { let mut set = nix::sys::select::FdSet::new(); - set.insert(fd); + let raw_fd = fd.as_fd().as_raw_fd(); + set.insert(raw_fd); let timeout = libc::timeval { tv_sec: 0, tv_usec: 100_000, @@ -137,7 +138,7 @@ pub fn read_ready(fd: std::os::unix::io::RawFd) -> bool { ) { Ok(n) => { if n > 0 { - set.contains(fd) + set.contains(raw_fd) } else { false } diff --git a/tests/input.rs b/tests/input.rs index 5b23b6a..1799cde 100644 --- a/tests/input.rs +++ b/tests/input.rs @@ -1,7 +1,6 @@ #![allow(clippy::collapsible_if)] use std::io::Write as _; -use std::os::unix::io::AsRawFd as _; mod fixtures; @@ -335,8 +334,7 @@ fn assert_line( fn assert_no_more_lines( f: &mut std::io::BufReader<&mut pty_process::blocking::Pty>, ) { - if fixtures::read_ready(f.get_ref().as_raw_fd()) || !f.buffer().is_empty() - { + if fixtures::read_ready(f.get_ref()) || !f.buffer().is_empty() { use std::io::Read as _; let mut buf = vec![0; 4096]; let bytes = f.read(&mut buf).unwrap(); |