Sending input to spawned process hangs
rahulmutt opened this issue · 0 comments
rahulmutt commented
From: https://lotz84.github.io/haskellbyexample/ex/spawning-processes
import System.Process
import System.IO
main :: IO ()
main = do
(Just hin, Just hout, _, _) <- createProcess (proc "grep" ["hello"]){ std_in = CreatePipe, std_out = CreatePipe }
hPutStr hin "hello grep\ngoodbye grep"
grepBytes <- hGetContents hout
putStrLn "> grep hello"
putStrLn grepBytes
should give
> grep hello
hello grep
but gives
> grep hello
[hangs]