RE: re-opening a closed stdin?

21 Nov
2002
21 Nov
'02
6:57 a.m.
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
8218
Age (days ago)
8218
Last active (days ago)
0 comments
1 participants
participants (1)
-
Simon Marlow