Catch File read exceptions in frontmatter
This commit is contained in:
parent
18825e7ced
commit
5a85d177c2
|
@ -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:/
|
||||
|
|
Loading…
Reference in a new issue