/// <summary> /// EndProcessing override. /// </summary> protected override void BeginProcessing() { // Convert ConnectingTimeout value from seconds to milliseconds. _connectionInfo = new NamedPipeInfo( processId: ProcessId, connectingTimeout: (ConnectingTimeout == Timeout.Infinite) ? Timeout.Infinite : ConnectingTimeout * 1000); _runspace = RunspaceFactory.CreateRunspace( connectionInfo: _connectionInfo, host: Host, typeTable: TypeTable.LoadDefaultTypeFiles(), applicationArguments: null, name: Name); _openAsync = new ManualResetEvent(false); _runspace.StateChanged += HandleRunspaceStateChanged; try { _runspace.OpenAsync(); _openAsync.WaitOne(); WriteObject( PSSession.Create( runspace: _runspace, transportName: "PSNPTest", psCmdlet: this)); } finally { _openAsync.Dispose(); } }
/// <summary> /// Create shallow copy of NamedPipeInfo object. /// </summary> public override RunspaceConnectionInfo Clone() { var connectionInfo = new NamedPipeInfo(ProcessId, ConnectingTimeout); connectionInfo._clientPipe = _clientPipe; return(connectionInfo); }
internal NamedPipeClientSessionTransportMgr( NamedPipeInfo connectionInfo, Guid runspaceId, PSRemotingCryptoHelper cryptoHelper) : base(runspaceId, cryptoHelper) { if (connectionInfo == null) { throw new PSArgumentException("connectionInfo"); } _connectionInfo = connectionInfo; }