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:
parent
dc82d222e5
commit
d4054444c0
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue