mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-30 00:00:16 +02:00
tests: update Nix to 0.22.0 (#3951)
This commit is contained in:
+1
-1
@@ -109,7 +109,7 @@ signal-hook-registry = { version = "1.1.1", optional = true }
|
|||||||
|
|
||||||
[target.'cfg(unix)'.dev-dependencies]
|
[target.'cfg(unix)'.dev-dependencies]
|
||||||
libc = { version = "0.2.42" }
|
libc = { version = "0.2.42" }
|
||||||
nix = { version = "0.19.0" }
|
nix = { version = "0.22.0" }
|
||||||
|
|
||||||
[target.'cfg(windows)'.dependencies.winapi]
|
[target.'cfg(windows)'.dependencies.winapi]
|
||||||
version = "0.3.8"
|
version = "0.3.8"
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ use std::{
|
|||||||
task::{Context, Waker},
|
task::{Context, Waker},
|
||||||
};
|
};
|
||||||
|
|
||||||
use nix::errno::Errno;
|
|
||||||
use nix::unistd::{close, read, write};
|
use nix::unistd::{close, read, write};
|
||||||
|
|
||||||
use futures::{poll, FutureExt};
|
use futures::{poll, FutureExt};
|
||||||
@@ -56,10 +55,6 @@ impl TestWaker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_blocking(e: &nix::Error) -> bool {
|
|
||||||
Some(Errno::EAGAIN) == e.as_errno()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct FileDescriptor {
|
struct FileDescriptor {
|
||||||
fd: RawFd,
|
fd: RawFd,
|
||||||
@@ -73,11 +68,7 @@ impl AsRawFd for FileDescriptor {
|
|||||||
|
|
||||||
impl Read for &FileDescriptor {
|
impl Read for &FileDescriptor {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
|
||||||
match read(self.fd, buf) {
|
read(self.fd, buf).map_err(io::Error::from)
|
||||||
Ok(n) => Ok(n),
|
|
||||||
Err(e) if is_blocking(&e) => Err(ErrorKind::WouldBlock.into()),
|
|
||||||
Err(e) => Err(io::Error::new(ErrorKind::Other, e)),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,11 +80,7 @@ impl Read for FileDescriptor {
|
|||||||
|
|
||||||
impl Write for &FileDescriptor {
|
impl Write for &FileDescriptor {
|
||||||
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
|
||||||
match write(self.fd, buf) {
|
write(self.fd, buf).map_err(io::Error::from)
|
||||||
Ok(n) => Ok(n),
|
|
||||||
Err(e) if is_blocking(&e) => Err(ErrorKind::WouldBlock.into()),
|
|
||||||
Err(e) => Err(io::Error::new(ErrorKind::Other, e)),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flush(&mut self) -> io::Result<()> {
|
fn flush(&mut self) -> io::Result<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user