summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/net/ssh/gateway.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/net/ssh/gateway.rb b/lib/net/ssh/gateway.rb
index aed6bdd..fce7c3e 100644
--- a/lib/net/ssh/gateway.rb
+++ b/lib/net/ssh/gateway.rb
@@ -165,7 +165,7 @@ class Net::SSH::Gateway
begin
Net::SSH.start("127.0.0.1", user, options.merge(:port => local_port), &block)
ensure
- close(local_port) if block
+ close(local_port) if block || $!
end
end