mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-27 01:45:56 +00:00
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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user