diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef2a5a9..f51dde75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ appear at the top. ## [Unreleased][] * Your contribution here! +* [#457](https://github.com/capistrano/sshkit/pull/457): https://github.com/capistrano/sshkit/pull/457 - [@eatwithforks](https://github.com/eatwithforks) * [#455](https://github.com/capistrano/sshkit/pull/455): Ensure UUID of commands are stable in logging - [@lazyatom](https://github.com/lazyatom) ## [1.18.2][] (2019-02-03) diff --git a/lib/sshkit/backends/netssh.rb b/lib/sshkit/backends/netssh.rb index 86538ffa..faf0c756 100644 --- a/lib/sshkit/backends/netssh.rb +++ b/lib/sshkit/backends/netssh.rb @@ -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