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.
This commit is contained in:
John MacFarlane 2014-04-05 19:57:42 -07:00
parent dc82d222e5
commit d4054444c0

View file

@ -176,7 +176,10 @@ runTeXProgram program runsLeft tmpDir source = do
let pdfFile = replaceDirectory (replaceExtension file ".pdf") tmpDir
pdfExists <- doesFileExist pdfFile
pdf <- if pdfExists
then Just `fmap` B.readFile pdfFile
-- We read PDF as a strict bytestring to make sure that the
-- temp directory is removed on Windows.
-- See https://github.com/jgm/pandoc/issues/1192.
then (Just . B.fromChunks . (:[])) `fmap` BS.readFile pdfFile
else return Nothing
return (exit, out <> err, pdf)