From 5b40debb5f042a1d4230ceb5f012e7d09a785fb2 Mon Sep 17 00:00:00 2001 From: Stanislav Alekseev <43210583+WeetHet@users.noreply.github.com> Date: Mon, 30 Sep 2024 09:54:22 +0300 Subject: [PATCH] Don't stop loading the env if direnv call fails (#18473) Before this we we would stop loading the environment if the call to direnv failed, which is not necessary in any way cc @mrnugget Release Notes: - Fixed the environment not loading if `direnv` mode is set to `direct` and `.envrc` is not allowed --- crates/project/src/environment.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/project/src/environment.rs b/crates/project/src/environment.rs index 641ad206c0..23d23c9dc6 100644 --- a/crates/project/src/environment.rs +++ b/crates/project/src/environment.rs @@ -198,8 +198,9 @@ async fn load_shell_environment( anyhow::ensure!( direnv_output.status.success(), - "direnv exited with error {:?}", - direnv_output.status + "direnv exited with error {:?}. Stderr:\n{}", + direnv_output.status, + String::from_utf8_lossy(&direnv_output.stderr) ); let output = String::from_utf8_lossy(&direnv_output.stdout); @@ -214,7 +215,7 @@ async fn load_shell_environment( let direnv_environment = match load_direnv { DirenvSettings::ShellHook => None, - DirenvSettings::Direct => load_direnv_environment(dir).await?, + DirenvSettings::Direct => load_direnv_environment(dir).await.log_err().flatten(), } .unwrap_or(HashMap::default());