diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-05-01 10:55:06 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-05-01 10:55:06 -0700 |
commit | effc6a9ed4c31960d53a21b85cdec16c3acfaa9c (patch) | |
tree | 9b28352a9c303e3b2881f939c4053d22f148de3a /src | |
parent | 9cdc9a72e7049266f57bc02ecf6621e77ede6e3d (diff) | |
download | pandoc-effc6a9ed4c31960d53a21b85cdec16c3acfaa9c.tar.gz |
Shared.openURL: Print diagnostic output to stderr, not stdout.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index bf988875b..39cc386e8 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -102,7 +102,7 @@ import Text.HTML.TagSoup (renderTagsOptions, RenderOptions(..), Tag(..), import qualified Data.ByteString as B import Network.HTTP (findHeader, rspBody, RequestMethod(..), HeaderName(..), mkRequest) -import Network.Browser (browse, setAllowRedirects, request) +import Network.Browser (browse, setAllowRedirects, setOutHandler, request) #ifdef EMBED_DATA_FILES import Text.Pandoc.Data (dataFiles) import System.FilePath ( joinPath, splitDirectories ) @@ -567,8 +567,10 @@ fetchItem sourceDir s = -- | Read from a URL and return raw data and maybe mime type. openURL :: String -> IO (B.ByteString, Maybe String) -openURL u = getBodyAndMimeType `fmap` - browse (setAllowRedirects True >> request (getRequest' u')) +openURL u = getBodyAndMimeType `fmap` browse + (do setOutHandler (UTF8.hPutStrLn stderr) + setAllowRedirects True + request (getRequest' u')) where getBodyAndMimeType (_, r) = (rspBody r, findHeader HdrContentType r) getRequest' uriString = case parseURI uriString of Nothing -> error ("Not a valid URL: " ++ |