Skip to content
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

refreshenv removes path entries #3021

Open
2 tasks done
sdarwin opened this issue Feb 13, 2023 · 0 comments
Open
2 tasks done

refreshenv removes path entries #3021

sdarwin opened this issue Feb 13, 2023 · 0 comments

Comments

@sdarwin
Copy link

sdarwin commented Feb 13, 2023

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

After installing a choco package, to add the new executable to the path, run this in powershell:

$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.." 
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv

The "problem" is that the PATH is completely overwritten. If you had modified it dynamically in the shell, prior to running refreshenv, the information is purged.

Maybe the user expects such a result. And, that is the desired behavior. But for me, if I had previously just run

$env:PATH = "$env:PATH;$new_path_entry"

I don't want to lose $new_path_entry by running refreshenv.

Describe The Solution. Why is it needed?

A proposed solution:

Add a -help flag for options to refreshenv.
Add a -keep flag to cause refreshenv to make a local copy of PATH before it does the refresh, and then merge the original and the new values together so that the final resulting PATH includes everything, and data is not lost.

Additional Context

No response

Related Issues

No response

@github-actions github-actions bot added the Pending Closure This issue has been marked as having no response or is stale and will soon be closed. label Jun 2, 2023
@chocolatey chocolatey deleted a comment from github-actions bot Jun 2, 2023
@pauby pauby added 0 - _Triaging and removed Pending Closure This issue has been marked as having no response or is stale and will soon be closed. labels Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants