[Haskell-cafe] haskell and releasing resources
Fawzi Mohamed
fmohamed at mac.com
Wed Feb 7 04:32:22 EST 2007
On Feb 7, 2007, at 1:05 AM, Donald Bruce Stewart wrote:
> mail:
>> Hi,
>>
>> Am Dienstag, den 06.02.2007, 15:56 +0100 schrieb Fawzi Mohamed:
>>> I am replying to myself, but anyway with it seems (from the
>>> documentation) that
>>>
>>> forkIO (do{ waitForProcess pid; return () })
>>>
>>> is the best solution, and does not seem to lead to wasted resources.
>>
>> This does not work for me. According to strace, the spawned
>> process is
>> in a blocking write, the haskell process is in a blocking waitpid,
>> and I
>> am sure that the program would consume all output.
>
> Any difference with -threaded ?
strange for me it works beautifully, even without -threaded, maybe
your process writes to stderr?
you could do something like
forkIO (do{ length(hGetContents err); return () })
(not tested) if you are not interested to the error output (and
maybe also a length of the input to be sure that you have read it all...
Fawzi
More information about the Haskell-Cafe
mailing list