diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-06 14:17:33 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-06 14:17:33 +0000 |
commit | 7660884ffd3db05c74b2d656a8285e1081571bc9 (patch) | |
tree | 4f490e01ef8ab24a152ea29dd2f31f4b1e7f0b44 /lib | |
parent | d627b1fcf35b4bd40ab30254e7244424c56c12ac (diff) | |
download | ruby-7660884ffd3db05c74b2d656a8285e1081571bc9.tar.gz ruby-7660884ffd3db05c74b2d656a8285e1081571bc9.tar.xz ruby-7660884ffd3db05c74b2d656a8285e1081571bc9.zip |
* lib/find.rb (Find.find): reduce stat system call.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@26028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/find.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/find.rb b/lib/find.rb index ee96e526e..f9bc75415 100644 --- a/lib/find.rb +++ b/lib/find.rb @@ -39,9 +39,13 @@ module Find while file = paths.shift catch(:prune) do yield file.dup.taint - next unless File.exist? file + begin + s = File.lstat(file) + rescue SystemCallError + next + end begin - if File.lstat(file).directory? then + if s.directory? then d = Dir.open(file) begin for f in d |