-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure Install-ChocolateyPath
adds a new entry to the PATH when part of it is already there
#3318
Closed
5 tasks done
Comments
10 tasks
Merged
9 tasks
pauby
changed the title
Install-ChocolateyPath does not add path if subpath already exists
Ensure May 28, 2024
Install-ChocolateyPath
adds a new entry to the PATH when part of it is already there
🎉 This issue has been resolved in version 2.3.0 🎉 The release is available on: Your GitReleaseManager bot 📦 🚀 |
2 tasks
10 tasks
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Oct 25, 2024
Some cmdlets should support ShouldProcess, this change ensures that they do correctly support it, along with adding checks to the underlying methods to make it work as users will expect. As Chocolatey CLI already supports --dry-run itself, this is primarily going to be useful for effectively unit testing the commands.
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Oct 25, 2024
Update-SessionEnvironment, Set-EnvironmentVariable, and (Un)Install-ChocolateyPath implement ShouldProcess, so we can use -WhatIf to verify their behaviour with unit tests.
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Nov 1, 2024
Some cmdlets should support ShouldProcess, this change ensures that they do correctly support it, along with adding checks to the underlying methods to make it work as users will expect. As Chocolatey CLI already supports --dry-run itself, this is primarily going to be useful for effectively unit testing the commands.
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Nov 1, 2024
Update-SessionEnvironment, Set-EnvironmentVariable, and (Un)Install-ChocolateyPath implement ShouldProcess, so we can use -WhatIf to verify their behaviour with unit tests.
corbob
pushed a commit
to vexx32/choco
that referenced
this issue
Nov 4, 2024
Some cmdlets should support ShouldProcess, this change ensures that they do correctly support it, along with adding checks to the underlying methods to make it work as users will expect. As Chocolatey CLI already supports --dry-run itself, this is primarily going to be useful for effectively unit testing the commands.
corbob
pushed a commit
to vexx32/choco
that referenced
this issue
Nov 4, 2024
Update-SessionEnvironment, Set-EnvironmentVariable, and (Un)Install-ChocolateyPath implement ShouldProcess, so we can use -WhatIf to verify their behaviour with unit tests.
corbob
added a commit
that referenced
this issue
Nov 4, 2024
(#3318) Add ShouldProcess support to rewritten helper cmdlets
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Nov 7, 2024
A couple of small errors in the -WhatIf tests showed up on teamcity, so this should hopefully fix those.
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Nov 7, 2024
A couple of small errors in the -WhatIf tests showed up on teamcity, so this should hopefully fix those.
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Nov 7, 2024
A couple of small errors in the -WhatIf tests showed up on teamcity, so this should hopefully fix those.
vexx32
added a commit
to vexx32/choco
that referenced
this issue
Nov 7, 2024
A couple of small errors in the -WhatIf tests showed up on teamcity, so this should hopefully fix those.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
What You Are Seeing?
I create my own internal Chocolatey packages. In the install script I have to use the command
Install-ChocolateyPath
. Thereby I want to have multiple folders of a program added to the PATH environment variable (here: "C:\tools\msys2\usr\bin" and "C:\tools\msys2"). But if "C:\tools\msys2\usr\bin" is already present in the PATH variable and "C:\tools\msys2" is not present (e.g. during an upgrade), thenInstall-ChocolateyPath
does not add the path anymore.It is not an environment update problem, because no change has taken place in the registry and the output of the command confirms this (see log). The cause of the error is in the condition that checks whether the path already exists in the PATH variable or not.
choco/src/chocolatey.resources/helpers/functions/Install-ChocolateyPath.ps1
Line 83 in 48ee5cf
What is Expected?
The path should be taken over into the PATH variable, even if a subpath of this path already exists in the variable. For this, it should be checked exactly whether the path is already included in the variable or not.
How Did You Get This To Happen?
Install-ChocolateyPath "C:\tools\msys64\" -pathType "Machine"
.System Details
Installed Packages
Output Log
Additional Context
I add a pull request that should fix the problem by matching the exact path to be added.
The text was updated successfully, but these errors were encountered: