Esempio n. 1
0
        protected override void StopProcessing()
        {
            IHostSupportsInteractiveSession host = base.Host as IHostSupportsInteractiveSession;

            if (host == null)
            {
                base.WriteError(new ErrorRecord(new ArgumentException(base.GetMessage(RemotingErrorIdStrings.HostDoesNotSupportPushRunspace)), PSRemotingErrorId.HostDoesNotSupportPushRunspace.ToString(), ErrorCategory.InvalidArgument, null));
            }
            else
            {
                host.PopRunspace();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Process record.
        /// </summary>
        protected override void ProcessRecord()
        {
            // Pop it off the local host.
            IHostSupportsInteractiveSession host = this.Host as IHostSupportsInteractiveSession;

            if (host == null)
            {
                WriteError(
                    new ErrorRecord(
                        new ArgumentException(GetMessage(RemotingErrorIdStrings.HostDoesNotSupportPushRunspace)),
                        nameof(PSRemotingErrorId.HostDoesNotSupportPushRunspace),
                        ErrorCategory.InvalidArgument,
                        null));
                return;
            }

            host.PopRunspace();
        }
Esempio n. 3
0
        /// <summary>
        /// Called by the engine to notify the host that a runspace pop has been requested.
        /// </summary>
        /// <seealso cref="PushRunspace"/>
        public void PopRunspace()
        {
            IHostSupportsInteractiveSession host = GetIHostSupportsInteractiveSession();

            host.PopRunspace();
        }