<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,8 @@
+=== (unreleased)
+
+* Avoid using 'ensure' in Net::SFTP.start since it causes unfriendly behavior when exceptions are raised [Jamis Buck]
+
+
 === 2.0.1 / 29 May 2008
 
 * Open files in binary mode to appease Windows [Jamis Buck]</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -21,10 +21,10 @@ Echoe.new('net-sftp', version) do |p|
   p.summary          = &quot;A pure Ruby implementation of the SFTP client protocol&quot;
   p.url              = &quot;http://net-ssh.rubyforge.org/sftp&quot;
 
-  p.dependencies     = [&quot;net-ssh &gt;=1.99.1&quot;]
+  p.dependencies     = [&quot;net-ssh &gt;=2.0.9&quot;]
 
   p.need_zip         = true
   p.include_rakefile = true
 
   p.rdoc_pattern     = /^(lib|README.rdoc|CHANGELOG.rdoc)/
-end
\ No newline at end of file
+end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -31,11 +31,21 @@ module Net
       session = Net::SSH.start(host, user, options)
       sftp = Net::SFTP::Session.new(session, &amp;block).connect!
 
-      sftp.loop if block_given?
+      if block_given?
+        sftp.loop
+        session.close
+        return nil
+      end
 
       sftp
-    ensure
-      session.close if session &amp;&amp; block_given?
+    rescue Exception =&gt; anything
+      begin
+        session.terminate!
+      rescue Exception
+        # swallow exceptions that occur while trying to shutdown
+      end
+
+      raise anything
     end
   end
 
@@ -57,4 +67,4 @@ class Net::SSH::Connection::Session
       sftp
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/net/sftp.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>bc755d31fab2e071b362e0ae7996fab6d72d76c4</id>
    </parent>
  </parents>
  <author>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </author>
  <url>http://github.com/jamis/net-sftp/commit/e401c03a9bd4bd7f19ad213d2ac1a177da8727f5</url>
  <id>e401c03a9bd4bd7f19ad213d2ac1a177da8727f5</id>
  <committed-date>2009-01-31T20:25:02-08:00</committed-date>
  <authored-date>2009-01-31T20:25:02-08:00</authored-date>
  <message>avoid using ensure in Net::SFTP.start to prevent hangs when exceptions are raised</message>
  <tree>fec44dacc3687d15e424d41b137f42c92629d2cd</tree>
  <committer>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </committer>
</commit>
