Close the file descriptor in has_yaml_header?

Previous method caused a problem where the calling Dir.chdir to get the next
directory's entries would cause the infamous 'Too many open files - getcwd'
error. Fixes #2279.
This commit is contained in:
Parker Moore 2014-05-06 15:58:25 -04:00
parent 1f94ca786d
commit c2d3f9d5b5
1 changed files with 1 additions and 1 deletions

View File

@ -433,7 +433,7 @@ module Jekyll
end end
def has_yaml_header?(file) def has_yaml_header?(file)
!!(File.open(file, "rb").read(5) =~ /\A---\r?\n/) !!(File.open(file, 'rb') { |f| f.read(5) } =~ /\A---\r?\n/)
end end
def limit_posts! def limit_posts!