aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-05-10 09:29:11 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-05-10 09:29:11 -0700
commit02993c2cc7bccc0e89911c48aa66396bbd42d513 (patch)
tree06b561a2b5779701e18b7eb5c2fd9eeda4d2a46d
parent285bbf61cf2b21278792e48aee7c25fa0ee62faa (diff)
downloadpandoc-02993c2cc7bccc0e89911c48aa66396bbd42d513.tar.gz
Made detection of latex program more robust.
Catch not-found error. Improves on 285bbf61cf2b21278792e48aee7c25fa0ee62faa to fix #2903.
-rw-r--r--pandoc.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/pandoc.hs b/pandoc.hs
index 56fa2c05f..76803be43 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, TupleSections #-}
+{-# LANGUAGE CPP, TupleSections, ScopedTypeVariables #-}
{-
Copyright (C) 2006-2016 John MacFarlane <jgm@berkeley.edu>
@@ -1402,7 +1402,10 @@ convertWithOpts opts args = do
_ | html5Output -> "wkhtmltopdf"
_ -> latexEngine
-- check for pdf creating program
- (ec,_,_) <- readProcessWithExitCode pdfprog ["--version"] ""
+ (ec,_,_) <- E.catch
+ (readProcessWithExitCode pdfprog ["--version"] "")
+ (\(_ :: E.SomeException) ->
+ return (ExitFailure 1,"",""))
when (ec /= ExitSuccess) $
err 41 $ pdfprog ++ " not found. " ++
pdfprog ++ " is needed for pdf output."