Skip to content

Commit

Permalink
Wait for children to exit correctly (fixes #4888)
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jun 24, 2019
1 parent 4f30e05 commit bbfaa1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Bug fixes:
* Removes dependency on gnu-tar for OSX and Linux environment. The
`--force-local` option was required only for windows environment.

* Properly wait for the `tar` subprocess to complete before returning, thereby
avoiding a SIGTERM screwing up GHC installation. See
[#4888](https://github.com/commercialhaskell/stack/issues/4888).

## v2.1.1.1

Expand Down
6 changes: 3 additions & 3 deletions src/Stack/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import System.IO.Echo (withoutInputEcho)
import qualified Data.Conduit.Binary as CB
import qualified Data.Conduit.List as CL
import Data.Conduit.Process.Typed (withLoggedProcess_, createSource, byteStringInput)
import RIO.Process (HasProcessContext (..), ProcessContext, setStdin, closed, getStderr, getStdout, proc, withProcess_, setStdout, setStderr, ProcessConfig, readProcess_, workingDirL)
import RIO.Process (HasProcessContext (..), ProcessContext, setStdin, closed, getStderr, getStdout, proc, withProcess_, setStdout, setStderr, ProcessConfig, readProcess_, workingDirL, waitExitCode)
import Data.Text.Encoding (decodeUtf8With)
import Data.Text.Encoding.Error (lenientDecode)

Expand Down Expand Up @@ -80,8 +80,8 @@ sinkProcessStderrStdout name args sinkStderr sinkStdout =
$ setStdin (byteStringInput "")
pc0
withProcess_ pc $ \p ->
runConduit (getStderr p .| sinkStderr) `concurrently`
runConduit (getStdout p .| sinkStdout)
(runConduit (getStderr p .| sinkStderr) `concurrently`
runConduit (getStdout p .| sinkStdout)) <* waitExitCode p

-- | 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
Expand Down

0 comments on commit bbfaa1c

Please sign in to comment.