From dc081c68a40662e62e11815aba780530cf3eb23a Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 4 Jan 2018 09:24:49 +0530 Subject: [PATCH] Use withProcess_ since process output is logged anyway Also fix function name (typo) referred in comments. --- src/Stack/Prelude.hs | 2 +- src/Stack/Setup.hs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Stack/Prelude.hs b/src/Stack/Prelude.hs index 538e6afc9c..bb379857fa 100644 --- a/src/Stack/Prelude.hs +++ b/src/Stack/Prelude.hs @@ -87,7 +87,7 @@ sinkProcessStderrStdout name args sinkStderr sinkStdout = -- | Consume the stdout of a process feeding strict 'ByteString's to a consumer. -- If the process fails, spits out stdout and stderr as error log -- level. Should not be used for long-running processes or ones with --- lots of output; for that use 'sinkProcessStdoutLogStderr'. +-- lots of output; for that use 'logProcessStderrStdout'. -- -- Throws a 'ReadProcessException' if unsuccessful. sinkProcessStdout diff --git a/src/Stack/Setup.hs b/src/Stack/Setup.hs index cabf2174fa..b51ba3ff08 100644 --- a/src/Stack/Setup.hs +++ b/src/Stack/Setup.hs @@ -46,7 +46,7 @@ import Data.Conduit (await, yield, awaitForever) import Data.Conduit.Lazy (lazyConsume) import Data.Conduit.Lift (evalStateC) import qualified Data.Conduit.List as CL -import Data.Conduit.Process.Typed (eceStderr, withLoggedProcess_) +import Data.Conduit.Process.Typed (eceStderr, createSource) import Data.Conduit.Zlib (ungzip) import Data.Foldable (maximumBy) import qualified Data.HashMap.Strict as HashMap @@ -1091,12 +1091,14 @@ installGHCPosix version downloadInfo _ archiveFile archiveType tempDir destDir = $ withEnvOverride menv' $ withProc cmd args $ try - . (flip withLoggedProcess_ $ \p -> + . (flip withProcess_ $ \p -> runConduit (getStderr p .| logLines) `concurrently_` runConduit (getStdout p .| logLines)) -- Calling the ./configure script requires that stdin is -- open . setStdin (useHandleOpen stdin) + . setStdout createSource + . setStderr createSource case result of Right _ -> return ()