git.iko.soy/typeable/pandoc
on master help sign in
PDF: create temp dir in . on Cygwin.

See #5451.

commit50885eabde6e9ba524d74a234154766f4c522627 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 19 Jul 2019, 09:41 (7 years ago) parentbd69218
1 file changed+4−1
src/Text/Pandoc/PDF.hs+4−1
src/Text/Pandoc/PDF.hs+4−1
@@ -42,6 +42,7 @@ import Text.Pandoc.Error (PandocError (PandocPDFProgramNotFoundError))
4242import Text.Pandoc.MIME (getMimeType)
4343import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..))
4444import Text.Pandoc.Process (pipeProcess)
45+import System.Process (readProcess)
4546import Text.Pandoc.Shared (inDirectory, stringify)
4647import qualified Text.Pandoc.UTF8 as UTF8
4748import Text.Pandoc.Walk (walkM)
@@ -89,7 +90,9 @@ makePDF program pdfargs writer opts doc =
8990 -- user names (see #777)
9091 let withTempDir templ action = do
9192 tmp <- getTemporaryDirectory
92− if '~' `elem` tmp
93+ uname <- E.catch (readProcess "uname" ["-o"] "")
94+ (\(_ :: E.SomeException) -> return "")
95+ if '~' `elem` tmp || uname == "Cygwin" -- see #5451
9396 then withTempDirectory "." templ action
9497 else withSystemTempDirectory templ action
9598 (newCommonState, res) <- liftIO $ withTempDir "tex2pdf." $ \tmpdir' -> do