You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2010/08/19 17:02:39 UTC

svn commit: r987180 - in /buildr/trunk: CHANGELOG lib/buildr/core/transports.rb

Author: boisvert
Date: Thu Aug 19 15:02:39 2010
New Revision: 987180

URL: http://svn.apache.org/viewvc?rev=987180&view=rev
Log:
BUILDR-491 sftp download goes into infinite loop

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/transports.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=987180&r1=987179&r2=987180&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Aug 19 15:02:39 2010
@@ -26,6 +26,7 @@
 * Fixed:  BUILDR-479 Enforce using a minimal version of jruby
 * Fixed:  BUILDR-481 Antwrap monkey-patching in core.rb
 * Fixed:  BUILDR-488 artifact poms not reinstalled
+* Fixed:  BUILDR-491 sftp download goes into infinite loop
 
 1.4.1 (2010-07-07)
 * Added:  BUILDR-420 Support external compiler

Modified: buildr/trunk/lib/buildr/core/transports.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/transports.rb?rev=987180&r1=987179&r2=987180&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/transports.rb (original)
+++ buildr/trunk/lib/buildr/core/transports.rb Thu Aug 19 15:02:39 2010
@@ -402,18 +402,20 @@ module URI
           trace 'connected'
 
           with_progress_bar options[:progress] && options[:size], path.split('/'), options[:size] || 0 do |progress|
-            trace "Downloading to #{path}"
+            trace "Downloading from #{path}"
             sftp.file.open(path, 'r') do |file|
               if block
                 while chunk = file.read(RW_CHUNK_SIZE)
                   block.call chunk
                   progress << chunk
+                  break if chunk.size < RW_CHUNK_SIZE
                 end
               else
                 result = ''
                 while chunk = file.read(RW_CHUNK_SIZE)
                   result << chunk
                   progress << chunk
+                  break if chunk.size < RW_CHUNK_SIZE
                 end
               end
             end