|
RE: Trouble with hDuplicateTo before exec: msg#00003lang.haskell.glasgow.bugs
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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [ ghc-Bugs-1106211 ] GHC panic, SourceForge.net |
|---|---|
| Next by Date: | [ ghc-Bugs-1114883 ] template Haskell fails in GHCi, SourceForge.net |
| Previous by Thread: | [ ghc-Bugs-1106211 ] GHC panic, SourceForge.net |
| Next by Thread: | [ ghc-Bugs-1114883 ] template Haskell fails in GHCi, SourceForge.net |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |