aboutsummaryrefslogtreecommitdiffstats
path: root/lib/net
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-08 06:08:20 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-08 06:08:20 +0000
commit4778a63f2da6e95c71be9547718406835df9ed28 (patch)
tree4f15058ebb0e0f27776886b6a4144076946137b7 /lib/net
parente3be976fcb60e6a0163c5202f0349acbd8a53de1 (diff)
downloadruby-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')
-rw-r--r--lib/net/ftp.rb13
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