Skip to content

Commit 566c4fa

Browse files
committed
Read the whole file into memory
when parsing multi-document files. Since parsing is lazy, just using `do` results in the file being closed before parsing happens. Leaving the file open and wating for the finalizer to close it was deemed undesirable.
1 parent 67dd8dd commit 566c4fa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/YAML.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,5 +164,8 @@ load_file(filename::AbstractString, args...; kwargs...) =
164164
Parse the YAML file `filename`, and return corresponding YAML documents.
165165
"""
166166
load_all_file(filename::AbstractString, args...; kwargs...) =
167-
load_all(open(filename, "r"), args...; kwargs...)
167+
open(filename, "r") do f
168+
io = IOBuffer(read(f))
169+
load_all(io, args...; kwargs...)
170+
end
168171
end # module

0 commit comments

Comments
 (0)