diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-08-14 13:02:54 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-08-14 13:02:54 -0700 |
commit | 8926230175e1d22199505f52914f4d5767e27f62 (patch) | |
tree | d5e91b385844e85acdbe2def800cf40379284be6 | |
parent | 3ebecad36287e41f327de4898902c96cce4b18fe (diff) | |
download | pandoc-8926230175e1d22199505f52914f4d5767e27f62.tar.gz |
Print stderr output of filters to stderr.
-rw-r--r-- | pandoc.hs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -47,7 +47,7 @@ import System.Console.GetOpt import Data.Char ( toLower ) import Data.List ( intercalate, isPrefixOf, sort ) import System.Directory ( getAppUserDataDirectory, doesFileExist, findExecutable ) -import System.IO ( stdout ) +import System.IO ( stdout, stderr ) import System.IO.Error ( isDoesNotExistError ) import qualified Control.Exception as E import Control.Exception.Extensible ( throwIO ) @@ -93,11 +93,11 @@ isTextFormat s = takeWhile (`notElem` "+-") s `notElem` ["odt","docx","epub","ep externalFilter :: FilePath -> [String] -> Pandoc -> IO Pandoc externalFilter f args' d = E.handle filterException $ do (exitcode, outbs, errbs) <- pipeProcess Nothing f args' $ encode d + when (not $ B.null errbs) $ B.hPutStr stderr errbs case exitcode of ExitSuccess -> return $ either error id $ eitherDecode' outbs ExitFailure _ -> err 83 $ "Error running filter " ++ f ++ "\n" ++ - UTF8.toStringLazy outbs ++ - UTF8.toStringLazy errbs + UTF8.toStringLazy outbs where filterException :: E.SomeException -> IO Pandoc filterException e = err 83 $ "Error running filter " ++ f ++ "\n" ++ show e |