git.iko.soy/typeable/pandoc
on master help sign in
Print stderr output of filters to stderr.
commit8926230175e1d22199505f52914f4d5767e27f62 authorJohn MacFarlane <jgm@berkeley.edu> dateWed 14 Aug 2013, 13:02 (13 years ago) parent3ebecad
1 file changed+3−3
pandoc.hs+3−3
pandoc.hs+3−3
@@ -47,7 +47,7 @@ import System.Console.GetOpt
4747import Data.Char ( toLower )
4848import Data.List ( intercalate, isPrefixOf, sort )
4949import System.Directory ( getAppUserDataDirectory, doesFileExist, findExecutable )
50−import System.IO ( stdout )
50+import System.IO ( stdout, stderr )
5151import System.IO.Error ( isDoesNotExistError )
5252import qualified Control.Exception as E
5353import Control.Exception.Extensible ( throwIO )
@@ -93,11 +93,11 @@ isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","ep
9393externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc
9494externalFilter f args' d = E.handle filterException $
9595 do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d
96+ when (not $ B.null errbs) $ B.hPutStr stderr errbs
9697 case exitcode of
9798 ExitSuccess -> return $ either error id $ eitherDecode' outbs
9899 ExitFailure _ -> err 83 $ "Error running filter " ++ f ++ "\n" ++
99− UTF8.toStringLazy outbs ++
100− UTF8.toStringLazy errbs
100+ UTF8.toStringLazy outbs
101101 where filterException :: E.SomeException -> IO Pandoc
102102 filterException e = err 83 $ "Error running filter " ++ f ++
103103 "\n" ++ show e