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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |