From c2d3f9d5b5e0c0c6b0cd8ca758db36f0d964edfe Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 6 May 2014 15:58:25 -0400 Subject: [PATCH] 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. --- lib/jekyll/site.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index a86ca5e2..648fad6c 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -433,7 +433,7 @@ module Jekyll end 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 def limit_posts!