@@ -562,20 +562,16 @@ withSingleContext ActionContext {..} ExecuteEnv {..} task@Task {..} inner0 =
562562 Just (_, h) -> UseHandle h
563563 , std_err =
564564 case mlogFile of
565- Nothing -> Inherit
565+ Nothing -> CreatePipe
566566 Just (_, h) -> UseHandle h
567567 }
568568 $ logProcessRun (toFilePath exeName) fullArgs
569569
570570 -- Use createProcess_ to avoid the log file being closed afterwards
571- (Just inH, moutH, Nothing , ph) <- liftIO $ createProcess_ " singleBuild" cp
571+ (Just inH, moutH, merrH , ph) <- liftIO $ createProcess_ " singleBuild" cp
572572 liftIO $ hClose inH
573- case moutH of
574- Just outH ->
575- case mlogFile of
576- Just {} -> return ()
577- Nothing -> printBuildOutput stripTHLoading outH
578- Nothing -> return ()
573+ maybePrintBuildOutput stripTHLoading LevelInfo mlogFile moutH
574+ maybePrintBuildOutput stripTHLoading LevelWarn mlogFile merrH
579575 ec <- liftIO $ waitForProcess ph
580576 case ec of
581577 ExitSuccess -> return ()
@@ -594,6 +590,14 @@ withSingleContext ActionContext {..} ExecuteEnv {..} task@Task {..} inner0 =
594590 (fmap fst mlogFile)
595591 bs
596592
593+ maybePrintBuildOutput stripTHLoading level mlogFile mh =
594+ case mh of
595+ Just h ->
596+ case mlogFile of
597+ Just {} -> return ()
598+ Nothing -> printBuildOutput stripTHLoading level h
599+ Nothing -> return ()
600+
597601singleBuild :: M env m
598602 => ActionContext
599603 -> ExecuteEnv
@@ -760,12 +764,12 @@ singleBench ac ee task =
760764-- | Grab all output from the given @Handle@ and print it to stdout, stripping
761765-- Template Haskell "Loading package" lines. Does work in a separate thread.
762766printBuildOutput :: (MonadIO m , MonadBaseControl IO m , MonadLogger m )
763- => Bool -> Handle -> m ()
764- printBuildOutput excludeTHLoading outH = void $ fork $
767+ => Bool -> LogLevel -> Handle -> m ()
768+ printBuildOutput excludeTHLoading level outH = void $ fork $
765769 CB. sourceHandle outH
766770 $$ CB. lines
767771 =$ CL. filter (not . isTHLoading)
768- =$ CL. mapM_ ($ logInfo . T. decodeUtf8)
772+ =$ CL. mapM_ (logOtherN level . T. decodeUtf8)
769773 where
770774 -- | Is this line a Template Haskell "Loading package" line
771775 -- ByteString
0 commit comments