From 9c3f5d087d38689064bc9d92f2b364005d0875d4 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Mon, 11 Apr 2016 12:21:25 -0500 Subject: [PATCH] (GH-303) Additional fixes for process env vars Process environment variables should be returned immediately --- .../helpers/functions/Get-EnvironmentVariable.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 index c4e328d79b..5f89044ba7 100644 --- a/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-EnvironmentVariable.ps1 @@ -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 @@ -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: $_"