Skip to content

Commit

Permalink
always close pool connections to avoid zlib warnings
Browse files Browse the repository at this point in the history
previously, we only closed connections when there are no errors.
when we hit errors while executing, we saw misleading zlib errors where instead it was just the ssh command failing.
so lets always close connections to avoid those errors.
  • Loading branch information
eatwithforks committed Mar 4, 2019
1 parent a703af2 commit 1c375be
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/sshkit/backends/netssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ def download!(remote, local=nil, options = {})

# Note that this pool must be explicitly closed before Ruby exits to
# ensure the underlying IO objects are properly cleaned up. We register an
# at_exit handler to do this automatically, as long as Ruby is exiting
# cleanly (i.e. without an exception).
# at_exit handler to do this automatically.
@pool = SSHKit::Backend::ConnectionPool.new
at_exit { @pool.close_connections if @pool && !$ERROR_INFO }
at_exit { @pool.close_connections if @pool }

class << self
attr_accessor :pool
Expand Down

0 comments on commit 1c375be

Please sign in to comment.