> > You can call 'System.Posix.IO.dup stdin' and save this value. > > However, I think you then need to explicitely read from this fd as > > it is not possible to reset what GHC thinks stdin is currently to > > this new fd (I'll dig into this and maybe we'll get a > > setStdin :: Fd -> IO () > > from this, IIRC somebody else was asking for this, too). > > How does this interact with Simon's proposal for hDuplicate?
If you actually want to change what stdin/stdout/stderr refer to, or re-open one of these file descriptors after it has been closed, then you need hDuplicateTo. I've enclosed a version of these functions which works with GHC 5.04.1. Cheers, Simon
hdup.hs
Description: hdup.hs