aboutsummaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-08-14 13:02:54 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2013-08-14 13:02:54 -0700
commit8926230175e1d22199505f52914f4d5767e27f62 (patch)
treed5e91b385844e85acdbe2def800cf40379284be6 /pandoc.hs
parent3ebecad36287e41f327de4898902c96cce4b18fe (diff)
downloadpandoc-8926230175e1d22199505f52914f4d5767e27f62.tar.gz
Print stderr output of filters to stderr.
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/pandoc.hs b/pandoc.hs
index 0df4cc555..a16ffbc3c 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -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