From 24fdc0e16cebf5327546e378e9a2a32441213b19 Mon Sep 17 00:00:00 2001 From: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:59:50 +0530 Subject: [PATCH] fix(env): Publish environment change when deleting variable (#5631) * fix(env): Publish environment change when deleting variable * Update CHANGELOG.md --- CHANGELOG.md | 2 +- lib/core.ps1 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e03c02a22d..c50f808295 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ - **core:** Fix `is_in_dir` under Unix ([#5391](https://github.com/ScoopInstaller/Scoop/issues/5391)) - **core:** Rewrite config file when needed ([#5439](https://github.com/ScoopInstaller/Scoop/issues/5439)) - **core:** Prevents leaking HTTP(S)_PROXY env vars to current sessions after Invoke-Git in parallel execution ([#5436](https://github.com/ScoopInstaller/Scoop/pull/5436)) -- **env:** Avoid automatic expansion of `%%` in env ([#5395](https://github.com/ScoopInstaller/Scoop/issues/5395), [#5452](https://github.com/ScoopInstaller/Scoop/pull/5452)) +- **env:** Avoid automatic expansion of `%%` in env ([#5395](https://github.com/ScoopInstaller/Scoop/issues/5395), [#5452](https://github.com/ScoopInstaller/Scoop/pull/5452), [#5631](https://github.com/ScoopInstaller/Scoop/pull/5631)) - **install:** Fix download from private GitHub repositories ([#5361](https://github.com/ScoopInstaller/Scoop/issues/5361)) - **scoop-info:** Fix errors in file size collection when `--verbose` ([#5352](https://github.com/ScoopInstaller/Scoop/pull/5352)) - **shim:** Use bash executable directly ([#5433](https://github.com/ScoopInstaller/Scoop/issues/5433)) diff --git a/lib/core.ps1 b/lib/core.ps1 index 1dba946508..ba26d01cb7 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -699,6 +699,7 @@ function env($name, $global, $val = '__get') { $EnvRegisterKey.GetValue($name, $null, $RegistryValueOption) } elseif ($val -eq $null) { $EnvRegisterKey.DeleteValue($name) + Publish-Env } else { $RegistryValueKind = if ($val.Contains('%')) { [Microsoft.Win32.RegistryValueKind]::ExpandString