diff options
Diffstat (limited to 'haddock-api/src/Haddock/Interface.hs')
-rw-r--r-- | haddock-api/src/Haddock/Interface.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/haddock-api/src/Haddock/Interface.hs b/haddock-api/src/Haddock/Interface.hs index 31991e25..4c7b70d7 100644 --- a/haddock-api/src/Haddock/Interface.hs +++ b/haddock-api/src/Haddock/Interface.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Haddock.Interface @@ -56,6 +57,13 @@ import Exception import GHC hiding (verbosity) import HscTypes import FastString (unpackFS) +import MonadUtils (liftIO) + +#if defined(mingw32_HOST_OS) +import System.IO +import GHC.IO.Encoding.CodePage (mkLocaleEncoding) +import GHC.IO.Encoding.Failure (CodingFailureMode(TransliterateCodingFailure)) +#endif -- | Create 'Interface's and a link environment by typechecking the list of -- modules using the GHC API and processing the resulting syntax trees. @@ -68,6 +76,10 @@ processModules -> Ghc ([Interface], LinkEnv) -- ^ Resulting list of interfaces and renaming -- environment processModules verbosity modules flags extIfaces = do +#if defined(mingw32_HOST_OS) + -- Avoid internal error: <stderr>: hPutChar: invalid argument (invalid character)' non UTF-8 Windows + liftIO $ hSetEncoding stderr $ mkLocaleEncoding TransliterateCodingFailure +#endif out verbosity verbose "Creating interfaces..." let instIfaceMap = Map.fromList [ (instMod iface, iface) | ext <- extIfaces |