summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-05-09 20:52:20 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-05-09 20:52:20 -0700
commit285bbf61cf2b21278792e48aee7c25fa0ee62faa (patch)
treecb413c2be0d7d130b5398f3c41517d1eba5d3572 /pandoc.hs
parentefd02db689d2815d9811d7841778a22ca4976783 (diff)
New method for checking for presence of tex program.
Now instead of using `findExecutable`, which has limitations on Windows, we just do `progname --version` and see if it returns successfully. Closes #2903.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/pandoc.hs b/pandoc.hs
index b686dbb90..56fa2c05f 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -52,6 +52,7 @@ import Data.Char ( toLower, toUpper )
import Data.List ( delete, intercalate, isPrefixOf, isSuffixOf, sort )
import System.Directory ( getAppUserDataDirectory, findExecutable,
doesFileExist, Permissions(..), getPermissions )
+import System.Process ( readProcessWithExitCode )
import System.IO ( stdout, stderr )
import System.IO.Error ( isDoesNotExistError )
import qualified Control.Exception as E
@@ -1401,8 +1402,8 @@ convertWithOpts opts args = do
_ | html5Output -> "wkhtmltopdf"
_ -> latexEngine
-- check for pdf creating program
- mbPdfProg <- findExecutable pdfprog
- when (isNothing mbPdfProg) $
+ (ec,_,_) <- readProcessWithExitCode pdfprog ["--version"] ""
+ when (ec /= ExitSuccess) $
err 41 $ pdfprog ++ " not found. " ++
pdfprog ++ " is needed for pdf output."