Skip to content

Deadlock sending stdin to a process which does not read it

This code writes some standard input to a command and collects the output:

(ih,oh,eh,ph) ← runInteractiveCommand cmd forkIO $ hPutStr ih i' -- separate thread in case cmd does not read stdin out ← hGetContents oh err ← hGetContents eh exit ← waitForProcess ph

But if cmd does not read from stdin, using ghc 6.10.3 or 6.8.2 on a mac (with or without -threaded), it seems to hang at waitForProcess. (I tried to work around this by adding forkIO at Heffalump's suggestion, but no difference. With ghc 6.10.3 on a gnu/linux machine, it works as intended.

Trac metadata
Trac field Value
Version 6.10.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/process
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information