Allow EnvironmentVariableCollection to unset variables #185200
Labels
api
feature-request
Request for new features or functionality
terminal-process
Problems launching processes, managing ptys, exiting, process leaks, etc.
Milestone
EnvironmentVariableCollection currently support modifying a variable, or deleting a modification in that collection, but not unsetting an environment variable.
Sometimes we want to unset variables in the direnv extension but there is no API for it (and if we force
null
orundefined
through the current API they get automatically stringified to"null"
and"undefined"
).The closest we can do is set them to the empty string (what POSIX calls null), but then some programs insist on distinguishing empty from undefined variables.
(N.B. Shells make this intentionally hard, for example the bash man page omits the expansion modifiers that distinguish null and unset variables.)
This could be done either by allowing
null
and/orundefined
as the replacement value forreplace
, or with a new method on the API.Related issue: direnv/direnv-vscode#527, and previously NixOS/nix#6409
Related commits: direnv/direnv-vscode@9905fe7, and previously direnv/direnv-vscode@79a4841
The text was updated successfully, but these errors were encountered: