diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2014-04-05 19:57:42 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2014-04-05 19:57:42 -0700 |
commit | d4054444c00449f49a8948eae91ad7bfdb36ea8e (patch) | |
tree | 4944b5ee34478a03f1d05e1d442639c34821af37 | |
parent | dc82d222e5826b5822a2f4d0d665a868a6561b78 (diff) | |
download | pandoc-d4054444c00449f49a8948eae91ad7bfdb36ea8e.tar.gz |
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.
-rw-r--r-- | src/Text/Pandoc/PDF.hs | 5 |
1 files changed, 4 insertions, 1 deletions
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) |