Skip to content

Commit

Permalink
Document the way readDockerProcess passes stderr unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaynard committed Mar 9, 2019
1 parent 8e7e467 commit 6e224f5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ inspects :: (HasProcessContext env, HasLogFunc env)
inspects [] = return Map.empty
inspects images =
do maybeInspectOut <-
-- not using 'readDockerProcess' as the error from a missing image
-- needs to be recovered.
try (BL.toStrict . fst <$> proc "docker" ("inspect" : images) readProcess_)
case maybeInspectOut of
Right inspectOut ->
Expand Down Expand Up @@ -844,11 +846,16 @@ removeDirectoryContents path excludeDirs excludeFiles =

-- | Produce a strict 'S.ByteString' from the stdout of a
-- process. Throws a 'ReadProcessException' exception if the
-- process fails. Logs process's stderr using @logError@.
-- process fails.
--
-- The stderr output is passed straight through, which is desirable for some cases
-- e.g. docker pull, in which docker uses stderr for progress output.
--
-- Use 'readProcess_' directly to customize this.
readDockerProcess
:: (HasProcessContext env, HasLogFunc env)
=> [String] -> RIO env BS.ByteString
readDockerProcess args = BL.toStrict <$> proc "docker" args readProcessStdout_ -- FIXME stderr isn't logged with logError, should it be?
readDockerProcess args = BL.toStrict <$> proc "docker" args readProcessStdout_

-- | Name of home directory within docker sandbox.
homeDirName :: Path Rel Dir
Expand Down

0 comments on commit 6e224f5

Please sign in to comment.