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

Closes #ISSUE

Release Notes:

- Python auto-venv activation in terminal now checks for path existence
before executing the activate script.
This commit is contained in:
Piotr Osiewicz 2025-01-07 21:57:58 +01:00 committed by GitHub
parent 9d5ae516fd
commit 7a66c764b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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