summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs27
1 files changed, 3 insertions, 24 deletions
diff --git a/pandoc.hs b/pandoc.hs
index 7a2a38d39..cb3d1e04a 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -52,9 +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 ( shell, CreateProcess(..), createProcess_,
- waitForProcess, StdStream(CreatePipe) )
-import System.IO ( stdout, stderr, hClose )
+import System.IO ( stdout, stderr )
import System.IO.Error ( isDoesNotExistError )
import qualified Control.Exception as E
import Control.Exception.Extensible ( throwIO )
@@ -1403,8 +1401,8 @@ convertWithOpts opts args = do
_ | html5Output -> "wkhtmltopdf"
_ -> latexEngine
-- check for pdf creating program
- progExists <- checkProg pdfprog
- when (not progExists) $
+ mbPdfProg <- findExecutable pdfprog
+ when (isNothing mbPdfProg) $
err 41 $ pdfprog ++ " not found. " ++
pdfprog ++ " is needed for pdf output."
@@ -1426,22 +1424,3 @@ convertWithOpts opts args = do
handleEntities = if htmlFormat && ascii
then toEntities
else id
-
--- Check for existence of prog by doing prog --version.
-checkProg :: String -> IO Bool
-checkProg "" = return False
-checkProg prog = E.handle handleErr $ do
- (_,Just o,Just e,p) <- createProcess_ "system"
- (shell (prog ++ " --version")){
- delegate_ctlc = True,
- std_out = CreatePipe,
- std_err = CreatePipe
- }
- ec <- waitForProcess p
- hClose o
- hClose e
- if ec == ExitSuccess
- then return True
- else return False
- where handleErr :: E.SomeException -> IO Bool
- handleErr _ = return False