[process] Fixed asynchronous exception bugs in readProcess and readProcessWithExitCode

Bas van Dijk v.dijk.bas at gmail.com
Thu Jan 12 20:35:38 CET 2012


Hi,

I fixed two asynchronous exception bugs in readProcess and
readProcessWithExitCode:

1) If an asynchronous exception was thrown to the thread executing
readProcess/readProcessWithExitCode somewhere after createProcess was
executed, the standard handles would not be closed anymore resulting
in a "handle leak" so to speak.

This is fixed by catching exceptions in the IO processing code and
closing the standard handles when an exception occurs. Additionally, I
also terminate the process and wait for its termination. Does the
latter make sense?

2) If an asynchronous exception was thrown to the
stdout/stderr-read-thread it did not execute the putMVar anymore
resulting in a dead-lock when takeMVar was executed.

This is fixed by properly catching exception in the read-thread and
propagating them to the parent thread which will then handle them as
described above.

Regards,

Bas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fixed-asynchronous-exception-bugs-in-readProcess.patch
Type: text/x-patch
Size: 7066 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20120112/6a6e7fdd/attachment.bin>


More information about the Libraries mailing list