git.iko.soy/typeable/pandoc
on master help sign in
Text.Pandoc.PDF: Ensure that temp directories deleted on Windows.

The PDF is now read as a strict bytestring, ensuring that process ownership will be terminated, so the temp directory can be deleted. Closes #1192.

commitd4054444c00449f49a8948eae91ad7bfdb36ea8e authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 5 Apr 2014, 19:57 (13 years ago) parentdc82d22
1 file changed+4−1
src/Text/Pandoc/PDF.hs+4−1
src/Text/Pandoc/PDF.hs+4−1
@@ -176,7 +176,10 @@ runTeXProgram program runsLeft tmpDir source = do
176176 let pdfFile = replaceDirectory (replaceExtension file ".pdf") tmpDir
177177 pdfExists <- doesFileExist pdfFile
178178 pdf <- if pdfExists
179− then Just `fmap` B.readFile pdfFile
179+ -- We read PDF as a strict bytestring to make sure that the
180+ -- temp directory is removed on Windows.
181+ -- See https://github.com/jgm/pandoc/issues/1192.
182+ then (Just . B.fromChunks . (:[])) `fmap` BS.readFile pdfFile
180183 else return Nothing
181184 return (exit, out <> err, pdf)
182185