From ddde7e1676daa85a5da8a7fca471eff7eca018b5 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 3 Apr 2012 09:49:22 +0300 Subject: [PATCH] yesod devel prints error messages too --- yesod/Devel.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yesod/Devel.hs b/yesod/Devel.hs index 166eabb4..af80a98f 100644 --- a/yesod/Devel.hs +++ b/yesod/Devel.hs @@ -28,7 +28,7 @@ import System.Posix.Types (EpochTime) import System.PosixCompat.Files (modificationTime, getFileStatus) import System.Process (createProcess, proc, terminateProcess, readProcess, waitForProcess, rawSystem, runInteractiveProcess) -import System.IO (hClose, hIsEOF, hGetLine) +import System.IO (hClose, hIsEOF, hGetLine, stdout, stderr, hPutStrLn) import Build (recompDeps, getDeps) @@ -210,14 +210,14 @@ rawSystemFilter :: String -> [String] -> IO ExitCode rawSystemFilter command args = do (inh, outh, errh, ph) <- runInteractiveProcess command args Nothing Nothing hClose inh - hClose errh - let go = do - isEof <- hIsEOF outh + let go handlein handleout = do + isEof <- hIsEOF handlein if isEof - then hClose outh + then hClose handlein else do - line <- hGetLine outh - unless ("Loading package " `L.isPrefixOf` line) $ putStrLn line - go - forkIO go + line <- hGetLine handlein + unless ("Loading package " `L.isPrefixOf` line) $ hPutStrLn handleout line + go handlein handleout + _ <- forkIO $ go outh stdout + _ <- forkIO $ go errh stderr waitForProcess ph