Fix overly noisy direnv error notification (#41029)
Cole Miller
created
Updates #40531, restoring the previous behavior which didn't surface an
error when no direnv binary was found.
Release Notes:
- N/A
Change summary
crates/project/src/environment.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Detailed changes
@@ -324,7 +324,9 @@ async fn load_direnv_environment(
env: &HashMap<String, String>,
dir: &Path,
) -> anyhow::Result<HashMap<String, Option<String>>> {
- let direnv_path = which::which("direnv").context("finding direnv binary")?;
+ let Some(direnv_path) = which::which("direnv").ok() else {
+ return Ok(HashMap::default());
+ };
let args = &["export", "json"];
let direnv_output = smol::process::Command::new(&direnv_path)