From d4054444c00449f49a8948eae91ad7bfdb36ea8e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 5 Apr 2014 19:57:42 -0700 Subject: 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. --- src/Text/Pandoc/PDF.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index 608cad2e9..abc5c41b7 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -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) -- cgit v1.2.3