Skip to content

Commit

Permalink
Avoid explicit case analysis of logLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishnan Parthasarathi committed Jan 3, 2018
1 parent 09b9f7e commit 048f8e0
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/Stack/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1086,27 +1086,18 @@ installGHCPosix version downloadInfo _ archiveFile archiveType tempDir destDir =

let runStep step wd env cmd args = do
menv' <- modifyEnvOverride menv (Map.union env)
logLevel <- logMinLevel <$> view logOptionsL
result <- case logLevel of
LevelDebug -> do
let logLines = CB.lines .| CL.mapM_ (logInfo . T.decodeUtf8With T.lenientDecode)
result <- do
let logLines = CL.mapM_ (logDebug . T.decodeUtf8With T.lenientDecode)
withWorkingDir wd
$ withEnvOverride menv'
$ withProc cmd args
$ try
. (flip withLoggedProcess_ $ \p ->
runConduit (getStderr p .| logLines) `concurrently_`
runConduit (getStdout p .| logLines))
. setStdin (useHandleOpen stdin)

_ -> withWorkingDir wd
$ withEnvOverride menv'
$ withProc cmd args
$ try
. (void . readProcessStdout_)
-- Calling the ./configure script requires that stdin is
-- open
. setStdin (useHandleOpen stdin)
. setStdin (useHandleOpen stdin)

case result of
Right _ -> return ()
Expand Down

0 comments on commit 048f8e0

Please sign in to comment.