From 297cb21a4749cd97ab16e07ffb6b299f757b89cc Mon Sep 17 00:00:00 2001 From: Marc Huffnagle Date: Mon, 29 Oct 2012 16:14:54 -0400 Subject: Net::SSH.start returns result of block It's useful (and expected) to have the result of evaluating a block returned. Net::HTTP.start has this behavior, for example. Updated Net::SSH to have the same behavior. --- lib/net/ssh.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/net/ssh.rb b/lib/net/ssh.rb index 82923a7..3575d82 100644 --- a/lib/net/ssh.rb +++ b/lib/net/ssh.rb @@ -190,8 +190,9 @@ module Net 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 -- cgit v1.2.1