lib/net/ssh.rb in net-ssh-2.6.1 vs lib/net/ssh.rb in net-ssh-2.6.2

- old
+ new

@@ -188,11 +188,12 @@ user = options.fetch(:user, user) if auth.authenticate("ssh-connection", user, options[:password]) connection = Connection::Session.new(transport, options) if block_given? - yield connection + retval = yield connection connection.close + retval else return connection end else transport.close