-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly
#11057
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
Conversation
|
@PowerShell/powershell-committee reviewed this and agree to accept these changes for Preview.6 |
pwshpwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/NativeCommandProcessor.cs
Outdated
Show resolved
Hide resolved
test/powershell/Modules/Microsoft.PowerShell.Security/certificateCommon.psm1
Outdated
Show resolved
Hide resolved
Co-Authored-By: Robert Holt <rjmholt@gmail.com>
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs
Outdated
Show resolved
Hide resolved
|
@PoshChan please retry windows |
|
@SteveL-MSFT, successfully started retry of |
| } | ||
| } | ||
|
|
||
| return string.Join(Path.PathSeparator, modulePathList.ToArray()); |
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.
I think the .ToArray() call is not needed.
I will resolve this in the web ui.
|
Why does this close #7082? |
|
🎉 Handy links: |
|
FYI this PR did not fix #9921 |
Issue fixed in PowerShell/PowerShell#11057, released in v7.0.0-preview.6, so available from version 7.0.0 Last Powershell version is 5.1 so 6 was already Powershell Core
PR Summary
Since
$env:PSModulePathis shared across all instances of PowerShell, PowerShell 7 needs to ensure it inherits the env var, but put its paths in front. If starting Windows PowerShell, it will special casepowershell.exeandpowershell_ise.exeremoving PowerShell 7 specific paths creating a new environment for the new process.This is a breaking change as previously, if
pwshdetects it is started from PowerShell, it will clear out$env:PSModulePathand create it from scratch. This change will preserve additions from the system or user env vars but not all have the complicated logic in Windows PowerShell. It will always add user module path, shared module path, and $PSHome module path if it's not already there on startup.PR Context
Fix #9957
Fix #9921
Fix #7082
Fix #6850
Fix #10620
Implement PowerShell/PowerShell-RFC#233
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.