diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-07-19 09:41:19 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-07-19 09:41:19 -0700 |
commit | 50885eabde6e9ba524d74a234154766f4c522627 (patch) | |
tree | a1642531177faad462da8828ef012423b8cf9bd2 /src | |
parent | bd69218451037df2215ba0cbbb95eda2c3000450 (diff) | |
download | pandoc-50885eabde6e9ba524d74a234154766f4c522627.tar.gz |
PDF: create temp dir in . on Cygwin.
See #5451.
Diffstat (limited to 'src')
-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 5826f9856..2a8842e97 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -42,6 +42,7 @@ import Text.Pandoc.Error (PandocError (PandocPDFProgramNotFoundError)) import Text.Pandoc.MIME (getMimeType) import Text.Pandoc.Options (HTMLMathMethod (..), WriterOptions (..)) import Text.Pandoc.Process (pipeProcess) +import System.Process (readProcess) import Text.Pandoc.Shared (inDirectory, stringify) import qualified Text.Pandoc.UTF8 as UTF8 import Text.Pandoc.Walk (walkM) @@ -89,7 +90,9 @@ makePDF program pdfargs writer opts doc = -- user names (see #777) let withTempDir templ action = do tmp <- getTemporaryDirectory - if '~' `elem` tmp + uname <- E.catch (readProcess "uname" ["-o"] "") + (\(_ :: E.SomeException) -> return "") + if '~' `elem` tmp || uname == "Cygwin" -- see #5451 then withTempDirectory "." templ action else withSystemTempDirectory templ action (newCommonState, res) <- liftIO $ withTempDir "tex2pdf." $ \tmpdir' -> do |