File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 88open Eio.Std
99
1010let ( / ) = Eio.Path.( / )
11+
12+ let run ?clear:(paths = []) fn =
13+ Eio_main.run @@ fun env ->
14+ let cwd = Eio.Stdenv.cwd env in
15+ List.iter (fun p -> Eio.Path.rmtree ~missing_ok:true (cwd / p)) paths;
16+ fn env
1117```
1218
1319``` ocaml
@@ -45,7 +51,7 @@ let with_tmp_file dir id fn =
4551Using a socket-pair:
4652
4753``` ocaml
48- # Eio_main. run @@ fun env ->
54+ # run ~clear:["tmp-foo.txt"; "tmp-bar.txt"] @@ fun env ->
4955 with_tmp_file env#cwd "foo" @@ fun fd1 ->
5056 with_tmp_file env#cwd "bar" @@ fun fd2 ->
5157 Switch.run @@ fun sw ->
@@ -60,7 +66,7 @@ Using a socket-pair:
6066Using named sockets:
6167
6268``` ocaml
63- # Eio_main. run @@ fun env ->
69+ # run ~clear:["tmp-foo.txt"] @@ fun env ->
6470 let net = env#net in
6571 with_tmp_file env#cwd "foo" @@ fun fd ->
6672 Switch.run @@ fun sw ->
You can’t perform that action at this time.
0 commit comments