git.iko.soy/typeable/pandoc
on master help sign in
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.

commit285bbf61cf2b21278792e48aee7c25fa0ee62faa authorJohn MacFarlane <jgm@berkeley.edu> dateMon 9 May 2016, 20:52 (10 years ago) parentefd02db
2 files changed+5−3
pandoc.cabal+2−1 pandoc.hs+3−2
pandoc.cabal+2−1
@@ -424,7 +424,8 @@ Executable pandoc
424424 aeson >= 0.7.0.5 && < 0.12,
425425 yaml >= 0.8.8.2 && < 0.9,
426426 containers >= 0.1 && < 0.6,
427− HTTP >= 4000.0.5 && < 4000.4
427+ HTTP >= 4000.0.5 && < 4000.4,
428+ process >= 1.0 && < 1.5
428429 if flag(network-uri)
429430 Build-Depends: network-uri >= 2.6 && < 2.7, network >= 2.6
430431 else
pandoc.hs+3−2
@@ -52,6 +52,7 @@ import Data.Char ( toLower, toUpper )
5252import Data.List ( delete, intercalate, isPrefixOf, isSuffixOf, sort )
5353import System.Directory ( getAppUserDataDirectory, findExecutable,
5454 doesFileExist, Permissions(..), getPermissions )
55+import System.Process ( readProcessWithExitCode )
5556import System.IO ( stdout, stderr )
5657import System.IO.Error ( isDoesNotExistError )
5758import qualified Control.Exception as E
@@ -1401,8 +1402,8 @@ convertWithOpts opts args = do
14011402 _ | html5Output -> "wkhtmltopdf"
14021403 _ -> latexEngine
14031404 -- check for pdf creating program
1404− mbPdfProg <- findExecutable pdfprog
1405− when (isNothing mbPdfProg) $
1405+ (ec,_,_) <- readProcessWithExitCode pdfprog ["--version"] ""
1406+ when (ec /= ExitSuccess) $
14061407 err 41 $ pdfprog ++ " not found. " ++
14071408 pdfprog ++ " is needed for pdf output."
14081409