From 8b3206aa928e60d65045b8780cbf42a1e522fc6d Mon Sep 17 00:00:00 2001 From: Jack Kleeman Date: Fri, 11 Oct 2024 08:44:00 +0100 Subject: [PATCH] Update crates/local-cluster-runner/src/node/mod.rs Co-authored-by: Pavel Tcholakov --- crates/local-cluster-runner/src/node/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/local-cluster-runner/src/node/mod.rs b/crates/local-cluster-runner/src/node/mod.rs index 29a48f992..1bd2b100c 100644 --- a/crates/local-cluster-runner/src/node/mod.rs +++ b/crates/local-cluster-runner/src/node/mod.rs @@ -567,7 +567,7 @@ impl StartedNode { pub async fn last_n_lines(&self, n: usize) -> Result, rev_lines::RevLinesError> { let log_file = self.log_file.clone(); - match tokio::task::spawn_blocking(move || { + tokio::task::spawn_blocking(move || { let log_file = std::fs::File::open(log_file)?; let mut lines = Vec::with_capacity(n); for line in RevLines::new(log_file).take(n) { @@ -576,10 +576,7 @@ impl StartedNode { Ok(lines) }) .await - { - Ok(res) => res, - Err(_) => Err(io::Error::other("background task failed").into()), - } + .unwrap_or_else(|_| Err(io::Error::other("background task failed").into())) } pub fn ingress_address(&self) -> Option<&SocketAddr> {