[MLton-commit] r6832
Wesley Terpstra
wesley at mlton.org
Fri Sep 5 06:02:36 PDT 2008
Don't use fork/exec with Process.callWithIn/Out. Instead, use the portable Unix.execute. This fixes mlprof for count/alloc profiling on win32.
----------------------------------------------------------------------
U mlton/trunk/lib/mlton/basic/process.sml
----------------------------------------------------------------------
Modified: mlton/trunk/lib/mlton/basic/process.sml
===================================================================
--- mlton/trunk/lib/mlton/basic/process.sml 2008-09-01 14:25:28 UTC (rev 6831)
+++ mlton/trunk/lib/mlton/basic/process.sml 2008-09-05 13:02:33 UTC (rev 6832)
@@ -378,23 +378,24 @@
fun callWithIn (name, args, f: In.t -> 'a) =
let
- val (pid, ins) =
- forkIn (fn out => In.withNull (fn ins => call (name, args) (ins, out)))
+ val pid = Unix.execute (name, args)
+ val () = TextIO.closeOut (Unix.textOutstreamOf pid)
+ val ins = Unix.textInstreamOf pid
in
Exn.finally
(fn () => In.withClose (ins, f),
- fn () => wait pid)
+ fn () => ignore (Unix.reap pid))
end
fun callWithOut (name, args, f: Out.t -> 'a) =
let
- val (pid, out) =
- forkOut
- (fn ins => Out.withNull (fn out => call (name, args) (ins, out)))
+ val pid = Unix.execute (name, args)
+ val () = TextIO.closeIn (Unix.textInstreamOf pid)
+ val out = Unix.textOutstreamOf pid
in
Exn.finally
(fn () => Out.withClose (out, f),
- fn () => wait pid)
+ fn () => ignore (Unix.reap pid))
end
(*
More information about the MLton-commit
mailing list