python: Check for activate script existence before running it (#22792)

Piotr Osiewicz created

Closes #ISSUE

Release Notes:

- Python auto-venv activation in terminal now checks for path existence
before executing the activate script.

Change summary

crates/project/src/terminals.rs | 3 +++
1 file changed, 3 insertions(+)

Detailed changes

crates/project/src/terminals.rs 🔗

@@ -433,6 +433,9 @@ impl Project {
             "windows" => "\r",
             _ => "\n",
         };
+        if smol::block_on(self.fs.metadata(path.as_ref())).is_err() {
+            return None;
+        }
         Some(format!(
             "{} {} ; clear{}",
             activate_keyword, quoted, line_ending