3.1.4.2 Closing a RunspacePool

The higher layer can initiate the closing of a RunspacePool. If the state of a RunspacePool is not Opened, the client does nothing. Otherwise, the following activities happen as part of the RunspacePool closure:

  1. The client stops any currently executing pipelines (section 3.1.4.4).

  2. The client sends a wxf:Delete message (section 3.1.5.3.11) using the ShellID stored in section 3.1.1.2.4.

  3. The client expects a wxf:DeleteResponse (section 3.2.5.3.12) from the server at this state. If wxf:DeleteResponse is received, the client changes the RunspacePool state (section 3.1.1.2) to Closed. If a wxf:Fault message is received, the client changes the RunspacePool state (section 3.1.1.2) to Broken.

  4. When the RunspacePool reaches a Closed or Broken state, the client removes the RunspacePool instance from the global table (section 3.1.1.1.1).