-
Notifications
You must be signed in to change notification settings - Fork 315
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
do not overwrite PSModulePath when setting up build environment #6697
Conversation
Signed-off-by: mwrock <matt@mattwrock.com>
@@ -1267,7 +1267,7 @@ function Invoke-SetupEnvironmentWrapper { | |||
# the real environment, except for PATH; for that, push the | |||
# runtime path onto the front of the system path | |||
foreach($k in $env["Runtime"].keys) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it significant that this "Runtime", while above we have "RunTime" (note capitalization)?
(same with "Buildtime" below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Powershell hash keys and variables are not case sensitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrmm... maybe it'd be better to be consistent.
If nothing else, it'd stop me from asking these questions 😉
Obvious fix; these changes are the result of automation not creative thinking.
The
PSModulePath
environment variable is where Powershell looks for modules. When entering a powershell shell, powershell will ensure that its ownmodules
directory which include the built in modules that ship with powershell are added to this variable when the shell starts.If a plan includes something like:
This will overwrite the existing
PSModulePath
and potentially cause powershell commands that leverage the distribution bundled modules to fail.An example would be any plan that takes a dep on
core/dsc-core
which includes the above code.This PR does 3 things:
PSModulePath
in the Studio creation code so that any module paths other than those included with the powershell vendored in the studio are not included.PSModulePath
to the list of variables inhab-plan-build
that should not be overwritten.Signed-off-by: mwrock matt@mattwrock.com