Fix parsing of direnv export json to support unset of environment variables + better logging (#32559)

Release Notes:

- Fixed parsing of `direnv export json` output to support unset of
environment variables.
This commit is contained in:
Michael Sloan
2025-06-11 17:57:30 +00:00
committed by GitHub
parent 65a1d09d24
commit 027ce6889c
2 changed files with 26 additions and 12 deletions
+7 -1
View File
@@ -274,7 +274,13 @@ async fn load_shell_environment(
},
};
if let Some(direnv_environment) = direnv_environment {
envs.extend(direnv_environment);
for (key, value) in direnv_environment {
if let Some(value) = value {
envs.insert(key, value);
} else {
envs.remove(&key);
}
}
}
(Some(envs), direnv_error)