sternmull · GitHub

On Windows the following program

module Main where
import System.Process
import System.IO
main :: IO ()
main = test 1
test i = do
  print i
  withCreateProcess ((shell "echo x") {std_out = CreatePipe}) $ \ _ (Just out) _ p -> do
    hGetChar out -- hGetLine and hGetContents have the same effect. But the problem disappears when this line is removed!
    return ()
  test $ i + 1

leads to output like this:

1
2
3
4
5
6
7
mytest.EXE: terminateProcess: permission denied (Permission denied)

Sometime it happens earlier sometimes it happens later. But as far i can tell it always happens pretty soon. I can not reproduce it on linux.

Read the original on github.com ↗