Interrupting readProcess doesn't work
The following program should terminate in 1 second, but it does not:
import System.Process import System.Timeout main = timeout 1000000 $ print =<< readProcess "sleep" ["2h"] ""
The problem is in the exception handler in
readProcess. When it receives an asynchronous exception, it tries to clean up by closing the pipes. However the attempt to close
outh blocks because the reader thread (reading with
hGetContents) is blocking on the handle.