re-opening a closed stdin?

Volker Stolz
Wed, 20 Nov 2002 13:27:21 +0100

In local.glasgow-haskell-users, you wrote:
> Is there any way in GHC to reopen stdin if it has been closed?

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).

The other way involves opening /dev/stdin on hosts that support this
(with the same limitation as above), including that that's currently
not possible! base/GHC/Handle.hs needs a little bit of convincing
(which I'm currently doing) for this to work.

-- *** PGP *** S/MIME