Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

during install, Initialize-ChocolateyPath, sets $env:ChocolateyInstall incorrectly #80

Closed
jamesmanning opened this issue Mar 9, 2012 · 5 comments

Comments

@jamesmanning
Copy link
Contributor

When I ran the install today (the iex from the web page) I got an error near the end of the install and the powershell I ran it from ended up with the wrong value set in $env:ChocolateyInstall

Output: http://pastebin.com/raw.php?i=Ur3efL95

The cause (AFAICT) is line 238 of the chocolateysetup.psm1

Source location: https://github.com/chocolatey/chocolatey/blob/master/nuget/tools/chocolateysetup.psm1#L238

$env:ChocolateyInstall = $chocolateyExePath

That sets the env var to the bin subdir instead of the correct dir, so my powershell (after running the install) had this value:

C:\Chocolatey » $env:ChocolateyInstall
C:\Chocolatey\bin
C:\Chocolatey »

AFAICT Initialize-ChocolateyPath shouldn't be setting this env var and should stick with just PATH things.

It would seem to make more sense (AFAICT) to set that env var around line 120 after we've finished the if/else and we know the right path is in the $chocolateyPath variable, so we could write it then:

$env:ChocolateyInstall = $chocolateyPath
@ferventcoder
Copy link
Contributor

Thanks. This definitely appears to be a bug...

@ferventcoder
Copy link
Contributor

Fixed in d34231f

@ferventcoder
Copy link
Contributor

By the way, what is the actual value of the environment variable on the machine? Closing and reopening powershell and calling this might be sufficient to get the machine value.

@ferventcoder
Copy link
Contributor

The error at the end is the changeover of chocolatey to a new folder and it having issues updating the powershell session's path.

@jamesmanning
Copy link
Contributor Author

Yeah, sorry, should have mentioned that - the actual value written with SetEnvironmentVariable is fine, and new shells (cmd, powershell, etc) have the right value. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants