Commit 6245446f authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Read captured process output as text

So we get windows cr/lf conversion and don't need a special lines'
implementation to deal with it. I'm guessing this is the problem that
Satoshi Kodama encountered with ghc-6.9 on Windows.
parent 4ec89675
......@@ -124,8 +124,8 @@ import System.FilePath
import System.Directory
( copyFile, createDirectoryIfMissing, renameFile )
import System.IO
( openBinaryFile, IOMode(ReadMode), stderr, stdout
, hPutStrLn, hPutStr, hFlush, hClose )
( Handle, openBinaryFile, IOMode(ReadMode), hSetBinaryMode
, stderr, stdout, hPutStrLn, hPutStr, hFlush, hClose )
import System.IO.Error as IO.Error
( try )
import qualified Control.Exception as Exception
......@@ -149,7 +149,6 @@ import System.Directory (getTemporaryDirectory)
import qualified Control.Exception as Exception
( throwIO )
import System.IO (Handle)
import Distribution.Compat.TempFile (openTempFile, openBinaryTempFile)
import Distribution.Verbosity
......@@ -295,6 +294,9 @@ rawSystemStdout' verbosity path args = do
(\(inh,outh,errh,_) -> hClose inh >> hClose outh >> hClose errh)
$ \(_,outh,errh,pid) -> do
-- We want to process the output as text.
hSetBinaryMode outh False
-- fork off a thread to pull on (and discard) the stderr
-- so if the process writes to stderr we do not block.
-- NB. do the hGetContents synchronously, otherwise the outer
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