@@ -44,7 +44,7 @@ import Text.Pandoc.SelfContained ( makeSelfContained )
4444import Text.Pandoc.Process (pipeProcess)
4545import Text.Highlighting.Kate ( languages, Style, tango, pygments,
4646 espresso, zenburn, kate, haddock, monochrome )
47−import System.Environment ( getArgs, getProgName, getEnvironment )
47+import System.Environment ( getArgs, getProgName )
4848import System.Exit ( exitWith, ExitCode (..) )
4949import System.FilePath
5050import System.Console.GetOpt
@@ -113,12 +113,15 @@ isTextFormat s = takeWhile (`notElem` "+-") s `notElem` binaries
113113
114114externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
115115externalFilter f args' d = do
116− mbPath <- lookup "PATH" <$> getEnvironment
117− mbexe <- if '/' `elem` f || mbPath == Nothing
118− -- don't check PATH if filter name has a path, or
119− -- if the PATH is not set
116+ mbexe <- if '/' `elem` f
117+ -- don't check PATH if filter name has a path
120118 then return Nothing
121− else findExecutable f
119+ -- we catch isDoesNotExistError because this will
120+ -- be triggered if PATH not set:
121+ else E.catch (findExecutable f)
122+ (\e -> if isDoesNotExistError e
123+ then return Nothing
124+ else throwIO e)
122125 (f', args'') <- case mbexe of
123126 Just x -> return (x, args')
124127 Nothing -> do