From c3b0c4fcd288c829bd21046dc0ed3ec00fdade24 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 16 Oct 2020 21:54:02 +0200 Subject: [PATCH] WIP: Bump tokio to 0.3 and mio to 0.7 This is currently pending on https://github.com/tokio-rs/tokio/pull/2903 in order to support registering a fd as a tokio Source. --- conch-runtime-tests/Cargo.toml | 2 +- conch-runtime/Cargo.toml | 6 +++--- conch-runtime/src/env/executable.rs | 2 +- conch-runtime/src/sys/unix/io.rs | 24 +++++++++++------------- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/conch-runtime-tests/Cargo.toml b/conch-runtime-tests/Cargo.toml index 8aa7460..07ec729 100644 --- a/conch-runtime-tests/Cargo.toml +++ b/conch-runtime-tests/Cargo.toml @@ -12,5 +12,5 @@ futures-core = "0.3" futures-util = "0.3" tempfile = "3.1" thiserror = "1" -tokio = { version = "0.2", features = ["full"] } +tokio = { version = "0.3", features = ["full"] } void = "1" diff --git a/conch-runtime/Cargo.toml b/conch-runtime/Cargo.toml index 4edff13..1a7ffeb 100644 --- a/conch-runtime/Cargo.toml +++ b/conch-runtime/Cargo.toml @@ -26,12 +26,12 @@ futures-util = "0.3" glob = "0.3" lazy_static = "1" thiserror = "1" -tokio = { version = "0.2", features = ["fs", "io-util", "process"] } +tokio = { version = "0.3", features = ["fs", "io-util", "process", "rt"] } void = "1" [target.'cfg(unix)'.dependencies] libc = "0.2" -mio = "0.6" +mio = "0.7" [target.'cfg(windows)'.dependencies.winapi] version = "0.3.4" @@ -48,7 +48,7 @@ features = [ [dev-dependencies] owned_chars = "0.3" -tokio = { version = "0.2", features = ["macros"] } +tokio = { version = "0.3", features = ["macros"] } [badges] travis-ci = { repository = "ipetkov/conch-runtime" } diff --git a/conch-runtime/src/env/executable.rs b/conch-runtime/src/env/executable.rs index a756762..a12dbf2 100644 --- a/conch-runtime/src/env/executable.rs +++ b/conch-runtime/src/env/executable.rs @@ -100,7 +100,7 @@ impl ExecutableEnvironment for TokioExecEnv { .map_err(|err| map_io_err(err, name.to_string_lossy().into_owned()))?; Ok(Box::pin(async move { - child.await.map(ExitStatus::from).unwrap_or(EXIT_ERROR) + child.wait().await.map(ExitStatus::from).unwrap_or(EXIT_ERROR) })) } } diff --git a/conch-runtime/src/sys/unix/io.rs b/conch-runtime/src/sys/unix/io.rs index 169af83..0220f24 100644 --- a/conch-runtime/src/sys/unix/io.rs +++ b/conch-runtime/src/sys/unix/io.rs @@ -49,29 +49,27 @@ impl From for FileDesc { } } -impl mio::Evented for FileDesc { +impl mio::event::Source for FileDesc { fn register( - &self, - poll: &mio::Poll, + &mut self, + registry: &mio::Registry, token: mio::Token, - interest: mio::Ready, - opts: mio::PollOpt, + interests: mio::Interest, ) -> Result<()> { - mio::unix::EventedFd(&self.as_raw_fd()).register(poll, token, interest, opts) + mio::unix::SourceFd(&self.as_raw_fd()).register(registry, token, interests) } fn reregister( - &self, - poll: &mio::Poll, + &mut self, + registry: &mio::Registry, token: mio::Token, - interest: mio::Ready, - opts: mio::PollOpt, + interests: mio::Interest, ) -> Result<()> { - mio::unix::EventedFd(&self.as_raw_fd()).reregister(poll, token, interest, opts) + mio::unix::SourceFd(&self.as_raw_fd()).reregister(registry, token, interests) } - fn deregister(&self, poll: &mio::Poll) -> Result<()> { - mio::unix::EventedFd(&self.as_raw_fd()).deregister(poll) + fn deregister(&mut self, registry: &mio::Registry) -> Result<()> { + mio::unix::SourceFd(&self.as_raw_fd()).deregister(registry) } }