Use a thunk to cause outfile to be closed

pull/12/head
Douglas Bates 2014-12-02 12:42:12 -06:00
parent 12a31c7396
commit 009c8baee4
1 changed files with 3 additions and 3 deletions

View File

@ -49,11 +49,11 @@ function weave(source ; doctype = "pandoc", plotlib="PyPlot", informat="noweb",
parsed = read_noweb(source)
executed = run(parsed)
formatted = format(executed, doctype)
outname = "$(report.cwd)/$(report.basename).$(formatdict[:extension])"
@show outname
outfile = open(outname, "w")
write(outfile, join(formatted, "\n"))
open(outname, "w") do io
write(io, join(formatted, "\n"))
end
info("Report weaved to $(report.basename).$(formatdict[:extension])")
end