On 31 January 2005 05:19, Volker Wysk wrote:

> "hDuplicateTo src tgt" overwrites the tgt handle with the src handle,
> but it doesn't overwrite the file descriptor used by tgt with that
> used by src. Rather, it makes a copy of src's fd and makes the
> overwritten tgt use that. 
> 
> That's fine as long as we're in Haskell. But consider "hDuplicateTo h
> stdin". When calling executeFile afterwards, the replaced process
> expects its standard input on handle 0, not on the new fd generated
> by hDuplicateTo. 
> 
> A workaround would be to use dupTo instead of hDuplicateTo, if we
> intend to call executeFile afterwards, but I have the case that this
> isn't known at the time. I'm forking a supplied IO action, connecting
> it with a pipe. The IO action may or may not call executeFile.

I've now made hDuplicateTo actually use dup2() underneath.

Cheers,
        Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to