Catch File read exceptions in frontmatter

This commit is contained in:
Thomas Reynolds 2014-08-29 10:24:45 -07:00
parent 18825e7ced
commit 5a85d177c2

View file

@ -176,7 +176,14 @@ module Middleman::CoreExtensions
return [data, nil] if !app.files.exists?(full_path) || ::Middleman::Util.binary?(full_path)
content = File.read(full_path)
# Avoid weird race condition when a file is renamed.
content = begin
File.read(full_path)
rescue ::EOFError
rescue ::IOError
rescue ::Errno::ENOENT
""
end
begin
if content =~ /\A.*coding:/