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:
parent
65a1d09d24
commit
027ce6889c
2 changed files with 26 additions and 12 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue