Skip to content

Commit

Permalink
Use withProcess_ since process output is logged anyway
Browse files Browse the repository at this point in the history
Also fix function name (typo) referred in comments.
  • Loading branch information
Krishnan Parthasarathi committed Jan 4, 2018
1 parent 5d2058a commit dc081c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Stack/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ()
Expand Down

0 comments on commit dc081c6

Please sign in to comment.