Skip to content

createPipe doesn't work on Windows #181

Description

@TerrorJack

Example program:

{-# LANGUAGE OverloadedStrings #-}

import qualified Data.ByteString as BS
import System.IO
import System.Process

main :: IO ()
main = do
  (h_read, h_write) <- createPipe
  let msg = "233"
  BS.hPut h_write msg
  hFlush h_write
  BS.hGet h_read (BS.length msg) >>= print

This prints "233" on Linux/macOS, but the program hangs indefinitely on Windows. Tested against ghc-8.10.1 which ships process-1.6.8.2, both on my Windows 10 laptop and on GitHub Actions.

Activity

  1. snoyberg commented on Jun 7, 2020

    @snoyberg
    Collaborator

    I don't have easy access to a Windows machine right now to test this out, and honestly don't have any ideas on what might be causing this. @Mistuke any thoughts?

  2. added a commit that references this issue on Jun 7, 2020
    46b5e35
  3. Mistuke commented on Jun 7, 2020

    @Mistuke
    Contributor

    @snoyberg #182 fixes this. The code isn't broken it's just the buffer size is ridiculously low.

    The write above blocks and is waiting for the read to drain it. but since everything is done on the same thread the program deadlocks.

  4. TerrorJack commented on Jun 7, 2020

    @TerrorJack
    ContributorAuthor

    @snoyberg I just validated locally and @Mistuke's patch works, with threaded/non-threaded runtime. Would be nice to have a minor release for the bugfix. Thanks for the timely patch :D

  5. snoyberg commented on Jun 8, 2020

    @snoyberg
    Collaborator

    Released on Hackage. Thanks @Mistuke!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions