diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-08 06:08:20 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-08 06:08:20 +0000 |
commit | d5d6b149df3d2d565859599334327e378e5b2a84 (patch) | |
tree | 4f15058ebb0e0f27776886b6a4144076946137b7 /lib | |
parent | 49cbfc8359801c5adf22d00d31ab6a7882b9374a (diff) | |
download | ruby-d5d6b149df3d2d565859599334327e378e5b2a84.tar.gz |
* lib/net/ftp.rb (list): fetch all the lines before yielding a block
to allow other commands in the block. [Feature #11454]
Patched by Srikanth Shreenivas.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/net/ftp.rb | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 3eec86ae99..724f4b85bd 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -755,15 +755,14 @@ module Net args.each do |arg| cmd = "#{cmd} #{arg}" end + lines = [] + retrlines(cmd) do |line| + lines << line + end if block - retrlines(cmd, &block) - else - lines = [] - retrlines(cmd) do |line| - lines << line - end - return lines + lines.each(&block) end + return lines end alias ls list alias dir list |