On Thu, Jun 9, 2011 at 16:40, Donn Cave <d...@avvanta.com> wrote:
> Quoth Erik Hesselink <hessel...@gmail.com>,
>> On Thu, Jun 9, 2011 at 13:40, Neil Davies <semanticphilosop...@gmail.com> 
>> wrote:
>>> Anyone out there got an elegant solution to being able to fork a haskell 
>>> thread and replace its 'stdin' ?
>>
>> If you don't mind being tied to GHC you can use hDuplicateTo from
>> GHC.IO.Handle [1]. You can also use dupTo from the unix package [2],
>> but that ties you to unix-like platforms instead.
>
> From reading about it, I would expect hDuplicate to to close and
> replace the input file descriptor for _all_ threads.
>
> Processes are of course the elegant way to separate effects like this.

Ah yes, you are right. I've done this before, but that was after a
double fork using 'forkProcess'.

Erik

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to