1 (* Copyright (C
) 1999-2006, 2008 Henry Cejtin
, Matthew Fluet
, Suresh
2 * Jagannathan
, and Stephen Weeks
.
4 * MLton is released under a BSD
-style license
.
5 * See the file MLton
-LICENSE for details
.
8 structure FileDesc
: FILE_DESC
=
10 open Posix
.IO Posix
.FileSys
14 val toString
= SysWord
.fmt
StringCvt.DEC
o fdToWord
15 val layout
= Layout
.str
o toString
19 then (dup2
{old
= from
, new
= to
}
23 fun fluidLet (d1
, d2
, f
) =
26 val _
= dup2
{old
= d2
, new
= d1
}
28 Exn
.finally (f
, fn () => move
{from
= copy
, to
= d1
})