[Haskell-cafe] Can't figure out source of race condition when using System.Process

Rafal Kolanski xs at xaph.net
Mon Nov 3 07:52:02 EST 2008

David Roundy wrote:
> On Sun, Nov 02, 2008 at 09:15:25PM +0100, Marc Weber wrote:
>> On Mon, Nov 03, 2008 at 01:02:12AM +1100, Rafal Kolanski wrote:
>>>  Rafal Kolanski.
>>> [...]
>> Why do you use forkIO here? It's not necessary. The process will run in
>> background on its own. ?
> It looks to me like this code requires a forkIO, not in the writing to inp,
> but rather in the reading of out and err.  Otherwise, those buffers may
> fill up and your process will hang...

It seems to be as you say. Trying for a single-threaded solution to this 
problem always locked up the program, until I found someone's code 
snippet online using forkIO and extrapolated from that.


Rafal Kolanski.

More information about the Haskell-Cafe mailing list