-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
This issue is opened based on the comment in PR #6939.
Class QueryRunspaces and enum SessionFilterState from ConnectPSSession.cs
QueryRunspaces is only used for session disconnect, which is only supported on Windows. PSRemotingCmdlets.cs is a heavily loaded file to support many remoting cmdlet base classes. Moving QueryRunspaces there just makes it more bloated and confusing in my opinion.
I feel that QueryRunspaces should be put into a separate utils file that can be skipped for Linux.
You should also #ifdef out its use in the Get-PSSession parameter set since it is not supported on Linux.
The type QueryRunspaces is only for session connection/disconnection. It's used in Connect-PSSession/Receive-PSSession/Get-PSSession and it's also directly used by the abstract class PSRunspaceCmdlet from PSRemotingCmdlet.cs. Now Connect-PSSession and Receive-PSSession are disabled in Unix build, but QueryRunspaces is still used in Get-PSSession (in getrunspacecommand.cs) and PSRunspaceCmdlet (in PSRemotingCmdlet.cs), even though the connenction/disconnection feature is not available on Unix platforms.
So, we need to properly disable all code realted to session connection/disconnection for Unix build, and then, as @PaulHigin suggested in the comment, QueryRunspaces and SessionFilterState probably should be moved a separate file that can be skipped for Unix build compilation.