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.
This commit is contained in:
Piotr Osiewicz 2025-01-23 12:32:21 +01:00 committed by GitHub
parent 91b0ca0895
commit 11bb906520
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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