Skip to content

Commit

Permalink
Merge pull request net-ssh#422 from mfazekas/ignore-disconnect-except…
Browse files Browse the repository at this point in the history
…ion-when-all-closed

Ignore Net::SSH::Disconnect when all channels closed
  • Loading branch information
mfazekas committed Aug 14, 2016
2 parents 1455fa2 + 7ebad22 commit 82de8d1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/net/ssh/connection/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ def closed?
def close
info { "closing remaining channels (#{channels.length} open)" }
channels.each { |id, channel| channel.close }
loop(0.1) { channels.any? }
begin
loop(0.1) { channels.any? }
rescue Net::SSH::Disconnect
raise unless channels.empty?
end
transport.close
end

Expand Down

0 comments on commit 82de8d1

Please sign in to comment.