Class: WinRM::Transport::ShellCloser
- Inherits:
-
Object
- Object
- WinRM::Transport::ShellCloser
- Defined in:
- lib/winrm/transport/shell_closer.rb
Overview
An object that can close a remote shell session over WinRM.
Instance Attribute Summary collapse
-
#shell_id ⇒ String?
The identifier for the current open remote shell session.
Instance Method Summary collapse
-
#call ⇒ Object
Closes the remote shell session.
-
#for(shell_id) ⇒ ShellCloser
A new ShellCloser with a copy of this object’s state and the shell_id set to the given parameter value.
-
#initialize(info, debug, args) ⇒ ShellCloser
constructor
Constructs a new ShellCloser.
Constructor Details
#initialize(info, debug, args) ⇒ ShellCloser
Constructs a new ShellCloser.
38 39 40 41 42 |
# File 'lib/winrm/transport/shell_closer.rb', line 38 def initialize(info, debug, args) @info = info @debug = debug @args = args end |
Instance Attribute Details
#shell_id ⇒ String?
Returns the identifier for the current open remote shell session.
30 31 32 |
# File 'lib/winrm/transport/shell_closer.rb', line 30 def shell_id @shell_id end |
Instance Method Details
#call ⇒ Object
Closes the remote shell session.
45 46 47 48 49 50 51 |
# File 'lib/winrm/transport/shell_closer.rb', line 45 def call(*) debug("[CommandExecutor] closing remote shell #{@shell_id} on #{@info}") ::WinRM::WinRMWebService.new(*@args).close_shell(@shell_id) debug("[CommandExecutor] remote shell #{@shell_id} closed") rescue => e debug("Exception: #{e.inspect}") end |
#for(shell_id) ⇒ ShellCloser
Returns a new ShellCloser with a copy of this object’s state and the shell_id set to the given parameter value.
56 57 58 |
# File 'lib/winrm/transport/shell_closer.rb', line 56 def for(shell_id) self.class.new(@info, @debug, @args).tap { |c| c.shell_id = shell_id } end |