From 11bb90652083ee1166ce7180e34cb7a4649d8b60 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:32:21 +0100 Subject: [PATCH] terminal: Check for script existence properly before activating it (#23476) We were not covering a variant where the returned metadata was Ok(None) Closes #ISSUE Release Notes: - Fixed venv activation script path showing up in terminal for non-existant scripts. --- crates/project/src/terminals.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/project/src/terminals.rs b/crates/project/src/terminals.rs index caad9eadc47c47d8a5f2a1a08dff6a9d640c70f2..3d8db4a3689622c79c3a92d117cea7a71e87c08e 100644 --- a/crates/project/src/terminals.rs +++ b/crates/project/src/terminals.rs @@ -490,9 +490,10 @@ impl Project { "windows" => "\r", _ => "\n", }; - if smol::block_on(self.fs.metadata(path.as_ref())).is_err() { - return None; - } + smol::block_on(self.fs.metadata(path.as_ref())) + .ok() + .flatten()?; + Some(format!( "{} {} ; clear{}", activate_keyword, quoted, line_ending