[process] Fixed asynchronous exception bugs in readProcess and readProcessWithExitCode

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

On Thu, Jan 12, 2012 at 14:35, Bas van Dijk
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.
Hah. I knew something like this was in there; xmonad is hanging instead of catching an exception or signal when the far end of a pipe (usually xmobar) goes away. -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

On 12 January 2012 23:14, Brandon Allbery
On Thu, Jan 12, 2012 at 14:35, Bas van Dijk
wrote: 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.
Hah. I knew something like this was in there; xmonad is hanging instead of catching an exception or signal when the far end of a pipe (usually xmobar) goes away.
It's good to hear that these fixes can actually solve a real problem :-) BTW I updated the patch in the ticket because I forgot to 'restore' the masking state in the IO processing code. Cheers, Bas
participants (2)
-
Bas van Dijk
-
Brandon Allbery