diff --git a/CHANGELOG.md b/CHANGELOG.md index f3be8bf3b..2557311c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - **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)) +- **core:** Avoid error messages when deleting non-existent environment variable ([#5547](https://github.com/ScoopInstaller/Scoop/issues/5547)) - **core:** Use relative path as fallback of `$scoopdir` ([#5544](https://github.com/ScoopInstaller/Scoop/issues/5544)) - **scoop-checkup:** Skip defender check in Windows Sandbox ([#5519](https://github.com/ScoopInstaller/Scoop/issues/5519)) - **buckets:** Avoid error messages for unexpected dir ([#5549](https://github.com/ScoopInstaller/Scoop/issues/5549)) diff --git a/lib/core.ps1 b/lib/core.ps1 index 389a028df..441eeef71 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -751,7 +751,7 @@ function env($name, $global, $val = '__get') { $RegistryValueOption = [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames $EnvRegisterKey.GetValue($name, $null, $RegistryValueOption) } elseif ($val -eq $null) { - $EnvRegisterKey.DeleteValue($name) + try { $EnvRegisterKey.DeleteValue($name) } catch { } Publish-Env } else { $RegistryValueKind = if ($val.Contains('%')) {