From 371c095ac28a5c89890c7bd215419b03593a297d Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:06:37 +0100 Subject: [PATCH 1/2] terminal: Check for script existence proper before activating it We were not covering a variant where the returned metadata was Ok(None) --- crates/project/src/terminals.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index caad9eadc47c47..15414f6de6e502 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -490,7 +490,11 @@ impl Project { "windows" => "\r", _ => "\n", }; - if smol::block_on(self.fs.metadata(path.as_ref())).is_err() { + if smol::block_on(self.fs.metadata(path.as_ref())) + .ok() + .flatten() + .is_none() + { return None; } Some(format!( From e6be6ac5d98ef419e3b65aa0795cbfc0053619d4 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Wed, 22 Jan 2025 21:18:15 +0100 Subject: [PATCH 2/2] Clippy --- crates/project/src/terminals.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index 15414f6de6e502..3d8db4a3689622 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -490,13 +490,10 @@ impl Project { "windows" => "\r", _ => "\n", }; - if smol::block_on(self.fs.metadata(path.as_ref())) + smol::block_on(self.fs.metadata(path.as_ref())) .ok() - .flatten() - .is_none() - { - return None; - } + .flatten()?; + Some(format!( "{} {} ; clear{}", activate_keyword, quoted, line_ending