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 | 4778a63f2da6e95c71be9547718406835df9ed28 (patch) | |
tree | 4f15058ebb0e0f27776886b6a4144076946137b7 /lib/net/ftp.rb | |
parent | e3be976fcb60e6a0163c5202f0349acbd8a53de1 (diff) | |
download | ruby-4778a63f2da6e95c71be9547718406835df9ed28.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/net/ftp.rb')
-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 |