Skip to content

Use process createPipe#6865

Merged
phadej merged 1 commit intohaskell:masterfrom
phadej:create-pipe
Jun 2, 2020
Merged

Use process createPipe#6865
phadej merged 1 commit intohaskell:masterfrom
phadej:create-pipe

Conversation

@phadej
Copy link
Copy Markdown
Collaborator

@phadej phadej commented Jun 1, 2020

cc @Mistuke

This doesn't yet work due

Unit Tests
  Distribution.Compat.CreatePipe
    Locale Encoding:                                                                      FAIL
      tests/UnitTests/Distribution/Compat/CreatePipe.hs:19:
      createPipe should support Unicode roundtripping
      expected: "\252"
       but got: "\195\188"

Compare:

createPipeInternal :: IO (Handle, Handle)
createPipeInternal = do
    (readfd, writefd) <- Posix.createPipe
    readh <- Posix.fdToHandle readfd
    writeh <- Posix.fdToHandle writefd
    return (readh, writeh)

and

createPipe = do
    (readfd, writefd) <- Posix.createPipe
    readh <- fdToHandle readfd
    writeh <- fdToHandle writefd
    hSetEncoding readh localeEncoding
    hSetEncoding writeh localeEncoding
    return (readh, writeh)
  where
    _ = callStack

I will think how to rip this locale dependency off. As we use this to read stderr and stdout using single pipe, we really should just read ByteString and don't care of what kind of "crap" test suites give us, i.e. simply pass it through.

If we need localeEncoding, that can be set outside.

Also add rawSystemIOWithEnvAndAction to allow
draining the spawned process output without async
(in a simple case of single output Handle).
@phadej phadej merged commit dde6255 into haskell:master Jun 2, 2020
@phadej phadej deleted the create-pipe branch June 2, 2020 09:23
@phadej phadej added this to the 3.4.0.0-rc1 milestone Jul 10, 2020
@phadej phadej mentioned this pull request Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant