Something went wrong. Try again.
In-memory resources for Eio
Something went wrong. Try again.
123456789101112131415161718open Eio
let ( / ) = Eio.Path.( / )
module L = Eio_mem.Low_level
let () = Eio_main.run @@ fun e -> Eio_mem.run ~stdout:e#stdout @@ fun env -> let () = Eio.Path.with_open_out ~create:(`If_missing 0o644) (env#fs / "hello.txt") @@ fun f -> let fd = Eio_mem.Resource.fd_opt f |> Option.get in L.dup2 ~src:fd ~tgt:L.Fd.stdout; Eio.Flow.copy_string "hello, world" env#stdout in Eio.traceln "Got: %s" (Eio.Path.load (env#fs / "hello.txt"))