E52C Allow `pwsh` to inherit `$env:PSModulePath` and enable `powershell.exe` to start correctly by SteveL-MSFT · Pull Request #11057 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@SteveL-MSFT
Copy link
Member
@SteveL-MSFT SteveL-MSFT commented Nov 13, 2019

PR Summary

Since $env:PSModulePath is 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 case powershell.exe and powershell_ise.exe removing PowerShell 7 specific paths creating a new environment for the new process.

This is a breaking change as previously, if pwsh detects it is started from PowerShell, it will clear out $env:PSModulePath and 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

@SteveL-MSFT SteveL-MSFT added the Breaking-Change breaking change that may affect users label Nov 13, 2019
@SteveL-MSFT SteveL-MSFT added Review - Committee The PR/Issue needs a review from the PowerShell Committee Committee-Reviewed PS-Committee has reviewed this and made a decision and removed Review - Committee The PR/Issue needs a review from the PowerShell Committee labels Nov 13, 2019
@SteveL-MSFT
Copy link
Member Author

@PowerShell/powershell-committee reviewed this and agree to accept these changes for Preview.6

@SteveL-MSFT SteveL-MSFT changed the title Enable Windows PowerShell to run from pwsh Allow pwsh to inherit $env:PSModulePath and enable powershell.exe to start correctly Nov 14, 2019
Co-Authored-By: Robert Holt <rjmholt@gmail.com>
@SteveL-MSFT
Copy link
Member Author

@PoshChan please retry windows

@PoshChan
Copy link
Collaborator

@SteveL-MSFT, successfully started retry of PowerShell-CI-Windows

}
}

return string.Join(Path.PathSeparator, modulePathList.ToArray());
Copy link
Member
@daxian-dbw daxian-dbw Nov 16, 2019

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.

@daxian-dbw daxian-dbw merged commit 2e55303 into PowerShell:master Nov 16, 2019
@rjmholt
Copy link
Collaborator
rjmholt commented Nov 16, 2019

Why does this close #7082?

@PaulHigin PaulHigin added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Nov 19, 2019
@PaulHigin PaulHigin added this to the 7.0.0-preview.6 milestone Nov 19, 2019
@ghost
Copy link
ghost commented Nov 21, 2019

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

@rjmholt
Copy link
Collaborator
rjmholt commented Dec 10, 2019

FYI this PR did not fix #9921

@SteveL-MSFT SteveL-MSFT deleted the psmodulepath branch June 6, 2020 02:29
1480c1 pushed a commit to m-ab-s/media-autobuild_suite that referenced this pull request Mar 31, 2022
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking-Change breaking change that may affect users CL-Engine Indicates that a PR should be marked as an engine change in the Change Log Committee-Reviewed PS-Committee has reviewed this and made a decision MustHave

Projects

None yet

5 participants

0