From e77305d3dc7e89474b14f86b180fc0ac51db3678 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 30 Sep 2023 20:21:09 +0200 Subject: Update dependencies --- crates/driver/Cargo.toml | 8 ++++---- crates/driver/src/driver.rs | 21 ++++++++++++++------- crates/driver/src/main.rs | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) (limited to 'crates/driver') diff --git a/crates/driver/Cargo.toml b/crates/driver/Cargo.toml index 9913a83..ecea8b8 100644 --- a/crates/driver/Cargo.toml +++ b/crates/driver/Cargo.toml @@ -11,15 +11,15 @@ edition = "2021" common = { path = "../common", package = "rebel-common" } runner = { path = "../runner", package = "rebel-runner" } -clap = "3.0.0-beta.2" +clap = { version = "4.0.0", features = ["derive"] } deb-version = "0.1.1" enum-kinds = "0.5.1" handlebars = "4.1.3" -indoc = "1.0.3" +indoc = "2.0.4" lazy_static = "1.4.0" -nix = "0.23.0" +nix = { version = "0.27.1", features = ["poll"] } nom = "7.1.0" scoped-tls-hkt = "0.1.2" serde = { version = "1", features = ["derive", "rc"] } -serde_yaml = "0.8" +serde_yaml = "0.9" walkdir = "2" diff --git a/crates/driver/src/driver.rs b/crates/driver/src/driver.rs index dfdd6e9..d0abbcb 100644 --- a/crates/driver/src/driver.rs +++ b/crates/driver/src/driver.rs @@ -349,17 +349,25 @@ impl<'ctx> Driver<'ctx> { } fn wait_for_task(&mut self) -> Result<()> { - let mut pollfds: Box<[_]> = self + let mut pollfds: Vec<_> = self .tasks_running - .keys() - .copied() - .map(|fd| poll::PollFd::new(fd, poll::PollFlags::POLLIN)) + .values() + .map(|(socket, _)| poll::PollFd::new(socket, poll::PollFlags::POLLIN)) .collect(); while poll::poll(&mut pollfds, -1).context("poll()")? == 0 {} - for pollfd in &*pollfds { - let events = pollfd.revents().expect("Unknown events in poll() return"); + let pollevents: Vec<_> = pollfds + .into_iter() + .map(|pollfd| { + ( + pollfd.as_fd().as_raw_fd(), + pollfd.revents().expect("Unknown events in poll() return"), + ) + }) + .collect(); + + for (fd, events) in pollevents { if !events.contains(poll::PollFlags::POLLIN) { if events.intersects(!poll::PollFlags::POLLIN) { return Err(Error::new( @@ -369,7 +377,6 @@ impl<'ctx> Driver<'ctx> { continue; } - let fd = pollfd.as_raw_fd(); let (socket, task_ref) = self.tasks_running.remove(&fd).unwrap(); let task_output = Runner::result(&socket)?; diff --git a/crates/driver/src/main.rs b/crates/driver/src/main.rs index ea97ee5..98aa10a 100644 --- a/crates/driver/src/main.rs +++ b/crates/driver/src/main.rs @@ -16,7 +16,7 @@ use clap::Parser; use runner::Runner; #[derive(Parser)] -#[clap(version = clap::crate_version!())] +#[clap(version, about)] struct Opts { /// Allow N jobs at once. /// Defaults to the number of available CPUs -- cgit v1.2.3