yesod devel prints error messages too

This commit is contained in:
Michael Snoyman 2012-04-03 09:49:22 +03:00
parent 9563865e30
commit ddde7e1676

View File

@ -28,7 +28,7 @@ import System.Posix.Types (EpochTime)
import System.PosixCompat.Files (modificationTime, getFileStatus) import System.PosixCompat.Files (modificationTime, getFileStatus)
import System.Process (createProcess, proc, terminateProcess, readProcess, import System.Process (createProcess, proc, terminateProcess, readProcess,
waitForProcess, rawSystem, runInteractiveProcess) waitForProcess, rawSystem, runInteractiveProcess)
import System.IO (hClose, hIsEOF, hGetLine) import System.IO (hClose, hIsEOF, hGetLine, stdout, stderr, hPutStrLn)
import Build (recompDeps, getDeps) import Build (recompDeps, getDeps)
@ -210,14 +210,14 @@ rawSystemFilter :: String -> [String] -> IO ExitCode
rawSystemFilter command args = do rawSystemFilter command args = do
(inh, outh, errh, ph) <- runInteractiveProcess command args Nothing Nothing (inh, outh, errh, ph) <- runInteractiveProcess command args Nothing Nothing
hClose inh hClose inh
hClose errh let go handlein handleout = do
let go = do isEof <- hIsEOF handlein
isEof <- hIsEOF outh
if isEof if isEof
then hClose outh then hClose handlein
else do else do
line <- hGetLine outh line <- hGetLine handlein
unless ("Loading package " `L.isPrefixOf` line) $ putStrLn line unless ("Loading package " `L.isPrefixOf` line) $ hPutStrLn handleout line
go go handlein handleout
forkIO go _ <- forkIO $ go outh stdout
_ <- forkIO $ go errh stderr
waitForProcess ph waitForProcess ph