Skip to content

Commit

Permalink
(GH-303) Additional fixes for process env vars
Browse files Browse the repository at this point in the history
Process environment variables should be returned immediately
  • Loading branch information
ferventcoder committed Apr 11, 2016
1 parent 5890c90 commit 9c3f5d0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ param(
[string] $USER_ENVIRONMENT_REGISTRY_KEY_NAME = "Environment";
[Microsoft.Win32.RegistryKey] $win32RegistryKey = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey($USER_ENVIRONMENT_REGISTRY_KEY_NAME)
} elseif ($Scope -eq [System.EnvironmentVariableTarget]::Process) {
[Environment]::GetEnvironmentVariable($Name, $Scope)
return [Environment]::GetEnvironmentVariable($Name, $Scope)
}

[Microsoft.Win32.RegistryValueOptions] $registryValueOptions = [Microsoft.Win32.RegistryValueOptions]::None
Expand All @@ -64,7 +64,7 @@ param(
[string] $environmentVariableValue = [string]::Empty

try {
Write-Verbose "Getting environment variable $Name"
#Write-Verbose "Getting environment variable $Name"
$environmentVariableValue = $win32RegistryKey.GetValue($Name, [string]::Empty, $registryValueOptions)
} catch {
Write-Debug "Unable to retrieve the $Name environment variable. Details: $_"
Expand Down

0 comments on commit 9c3f5d0

Please sign in to comment.