Commit fb970193 authored by Simon Marlow's avatar Simon Marlow

copyFileWithHeader: use binary Handles

Fixes failure when Haddocking Data.Monoid in libraries/base
parent 20633c5b
...@@ -420,12 +420,13 @@ copyWithHeader :: DynFlags -> String -> Maybe String -> FilePath -> FilePath ...@@ -420,12 +420,13 @@ copyWithHeader :: DynFlags -> String -> Maybe String -> FilePath -> FilePath
copyWithHeader dflags purpose maybe_header from to = do copyWithHeader dflags purpose maybe_header from to = do
showPass dflags purpose showPass dflags purpose
h <- openFile to WriteMode hout <- openBinaryFile to WriteMode
ls <- readFile from -- inefficient, but it'll do for now. hin <- openBinaryFile from ReadMode
-- ToDo: speed up via slurping. ls <- hGetContents hin -- inefficient, but it'll do for now. ToDo: speed up
maybe (return ()) (hPutStr h) maybe_header maybe (return ()) (hPutStr hout) maybe_header
hPutStr h ls hPutStr hout ls
hClose h hClose hout
hClose hin
getExtraViaCOpts :: DynFlags -> IO [String] getExtraViaCOpts :: DynFlags -> IO [String]
getExtraViaCOpts dflags = do getExtraViaCOpts dflags = do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment