Skip to content

Commit 1c375be

Browse files
committed
always close pool connections to avoid zlib warnings
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.
1 parent a703af2 commit 1c375be

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/sshkit/backends/netssh.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ def download!(remote, local=nil, options = {})
7979

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

8786
class << self
8887
attr_accessor :pool

0 commit comments

Comments
 (0)