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

commit58cbd20b1ffb77d4f67a81bfc4d1d953865b4732 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 17 Aug 2014, 10:33 (12 years ago) parenteab5fbb
1 file changed+9−6
pandoc.hs+9−6
pandoc.hs+9−6
@@ -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