mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-05-04 00:31:27 +00:00
fix(core): Avoid error messages when deleting non-existent environment variable (#5547)
* fix(core): Check if the envrionment variable exists before delete * CHANGELOG * Use `try, catch`, value of env variable may is null/empty * UPDATE CHANGELOG * Brackets --------- Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
This commit is contained in:
@@ -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))
|
||||
|
||||
+1
-1
@@ -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('%')) {
|
||||
|
||||
Reference in New Issue
Block a user