From 399de409d113b9a07a5ba9025e3cebd0fe33865c Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Sat, 5 Apr 2008 22:03:35 -0600 Subject: auto close the port if the connect failed --- lib/net/ssh/gateway.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.1