-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Miscellaneous minor updates to WinCompat #11980
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
test/powershell/Modules/Microsoft.PowerShell.Core/CompatiblePSEditions.Module.Tests.ps1
Show resolved
Hide resolved
|
The Get-PSSession fix is critical for anyone who wants to run PS 7 in critical production environments and so uses $ErrorActionPreference = 'Stop'. It cannot be overridden manually with -ErrorActionPreference:Continue; the only workaround is to set the variable to Continue and then run it, but then you require extra code to detect and parse if any errors occurred loading the module. Alternately, Import-WinModule can be used instead. Hope this gets merged in and made available ASAP. |
|
@iSazonov looks like this is ready for merge. |
|
🎉 Handy links: |
|
🎉 Handy links: |
* Filter PSModulePath when starting PS 5.1. Removing PS-Core-specific paths from PSModulePath of WinCompat process (Windows PS). * Make implicit WinCompat respect NoClobber and Scope parameters * Add ErrorAction.Ignore when searching for WinPSCompatSession # Conflicts: # src/System.Management.Automation/engine/Modules/ModuleCmdletBase.cs
PR Summary
Several small fixes to some WinCompat scenarios:
Removing PS-Core-specific paths from
PSModulePathof WinCompat process (Windows PS). Similar change was done previously by Allowpwshto inherit$env:PSModulePathand enablepowershell.exeto start correctly #11057 for NativeCommandProcessor. This PR enables samePSModulePathbehavior for WinCompat process (Windows PS) and job's process (Windows PS - for jobs started with-PSVersion 5.1). Without this change there could be bad cases when WinCompat process was loading PS-Core versions of the modules.Some implicit WinCompat scenarios were ignoring
-NoClobberand-Scopeparameters. This is now fixed.Get-PSSession -Namegenerates an error when the session is not found (in addition to returning nothing). When WinCompat usesGet-PSSessionto search for existingWinPSCompatSessionsession to reuse, such error is not shown to the user but it is written to the error stream. Considering that it is normal forWinPSCompatSessionsession to not be there before the first WinCompat module import, such error is expected but it may confuse user if it is found in the error stream. The fix is to doGet-PSSession -Name WinPSCompatSession -ErrorAction Ignore.Fix The remote session with the name WinPSCompatSession is not available #11903
Fixed a test bug in
ModulePath.Tests.ps1.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.