summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-08-17 10:33:18 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-08-17 10:33:18 -0700
commit58cbd20b1ffb77d4f67a81bfc4d1d953865b4732 (patch)
treedb6487e4dc88d44f7a021a5b4ed0333c6df802c8 /pandoc.hs
parenteab5fbb4fd9644af0d98e76a4e606e4a7d454298 (diff)
Removed check for PATH variable in running filters.
This cause problems on Windows 8, where the variable is called `Path`. Instead, simply trap the exception that will be raised by `findExecutable` if path is not set. This should fix #1542.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/pandoc.hs b/pandoc.hs
index c2d4ca853..d3fc3a1f5 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -44,7 +44,7 @@ import Text.Pandoc.SelfContained ( makeSelfContained )
import Text.Pandoc.Process (pipeProcess)
import Text.Highlighting.Kate ( languages, Style, tango, pygments,
espresso, zenburn, kate, haddock, monochrome )
-import System.Environment ( getArgs, getProgName, getEnvironment )
+import System.Environment ( getArgs, getProgName )
import System.Exit ( exitWith, ExitCode (..) )
import System.FilePath
import System.Console.GetOpt
@@ -113,12 +113,15 @@ isTextFormat s = takeWhile (`notElem` "+-") s `notElem` binaries
externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
externalFilter f args' d = do
- mbPath <- lookup "PATH" <$> getEnvironment
- mbexe <- if '/' `elem` f || mbPath == Nothing
- -- don't check PATH if filter name has a path, or
- -- if the PATH is not set
+ mbexe <- if '/' `elem` f
+ -- don't check PATH if filter name has a path
then return Nothing
- else findExecutable f
+ -- we catch isDoesNotExistError because this will
+ -- be triggered if PATH not set:
+ else E.catch (findExecutable f)
+ (\e -> if isDoesNotExistError e
+ then return Nothing
+ else throwIO e)
(f', args'') <- case mbexe of
Just x -> return (x, args')
Nothing -> do