Open
Description
I'm not sure if this is supposed to go here or in process
, but this code fails about 1 iteration in 200:
#!/usr/bin/env stack
-- stack --resolver lts-16.31 script
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import qualified Data.ByteString as SB
import System.IO
import System.Mem
import System.Process.Typed
main :: IO ()
main =
forM_ [1 .. 10000] $ \i -> do
withProcessTerm (setStdin createPipe $ setStdout createPipe $ setStderr inherit $ proc "cat" []) $ \ph -> do
putStrLn $ "Iteration: " <> show i
let inHandle = getStdin ph
let outHandle = getStdout ph
let contents = "Hello world\n"
SB.hPut inHandle contents
hFlush inHandle
output <- SB.hGet outHandle (SB.length contents)
when (output /= contents) $ fail "failed to read."
I couldn't reproduce the failure without the interaction with the standard streams, so I may very well be doing something wrong, but every 200 iterations or so I see this:
Iteration: 134
Iteration: 135
Iteration: 136
repro.hs: waitForProcess: does not exist (No child processes)
Metadata
Metadata
Assignees
Labels
No labels