Method: Net::SSH::Connection::Session#close

Defined in:
lib/net/ssh/connection/session.rb

#closeObject

Closes the session gracefully, blocking until all channels have successfully closed, and then closes the underlying transport layer connection.



121
122
123
124
125
126
127
128
129
130
# File 'lib/net/ssh/connection/session.rb', line 121

def close
  info { "closing remaining channels (#{channels.length} open)" }
  channels.each { |id, channel| channel.close }
  begin
    loop(0.1) { channels.any? }
  rescue Net::SSH::Disconnect
    raise unless channels.empty?
  end
  transport.close
end