Skip to content

Commit 988e85a

Browse files
committed
Get MDX tests working on Windows
1 parent 355f8da commit 988e85a

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# To work around MDX issues
2+
README.md text eol=lf

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,12 +752,17 @@ Eio.Io Net Connection_failure Refused Unix_error (Connection refused, "connect",
752752
```
753753

754754
If we ran this using another backend, the `Unix_error` part might change.
755-
To avoid this problem, you can use `Eio.Exn.Backend.show` to hide the backend-specific part of errors:
755+
To avoid this problem, you can use `Eio.Exn.Backend.show`
756756

757757
```ocaml
758758
# Eio.Exn.Backend.show := false;;
759759
- : unit = ()
760+
```
761+
762+
to hide the backend-specific part of errors:
760763

764+
<!-- $MDX skip -->
765+
```ocaml
761766
# Eio_main.run @@ fun env ->
762767
let net = Eio.Stdenv.net env in
763768
Switch.run @@ fun sw ->
@@ -842,7 +847,8 @@ let try_mkdir path =
842847
The checks also apply to following symlinks:
843848

844849
```ocaml
845-
# Unix.symlink "dir1" "link-to-dir1"; Unix.symlink "/tmp" "link-to-tmp";;
850+
# Unix.symlink "dir1" "link-to-dir1";
851+
Unix.symlink (Filename.get_temp_dir_name ()) "link-to-tmp";;
846852
- : unit = ()
847853
848854
# Eio_main.run @@ fun env ->
@@ -881,6 +887,7 @@ perhaps with `open_dir` to constrain all access to be within that directory.
881887

882888
Spawning a child process can be done using the [Eio.Process][] module:
883889

890+
<!-- $MDX non-deterministic=command -->
884891
```ocaml
885892
# Eio_main.run @@ fun env ->
886893
let proc_mgr = Eio.Stdenv.process_mgr env in
@@ -892,6 +899,7 @@ hello
892899
There are various optional arguments for setting the process's current directory or connecting up the standard streams.
893900
For example, we can use `tr` to convert some text to upper-case:
894901

902+
<!-- $MDX non-deterministic=command -->
895903
```ocaml
896904
# Eio_main.run @@ fun env ->
897905
let proc_mgr = Eio.Stdenv.process_mgr env in
@@ -904,6 +912,7 @@ ONE TWO THREE
904912
If you want to capture the output of a process, you can provide a suitable `Eio.Flow.sink` as the `stdout` argument,
905913
or use the `parse_out` convenience wrapper:
906914

915+
<!-- $MDX non-deterministic=command -->
907916
```ocaml
908917
# Eio_main.run @@ fun env ->
909918
let proc_mgr = Eio.Stdenv.process_mgr env in
@@ -913,6 +922,7 @@ or use the `parse_out` convenience wrapper:
913922

914923
All process functions either return the exit status or check that it was zero (success):
915924

925+
<!-- $MDX non-deterministic=command -->
916926
```ocaml
917927
# Eio_main.run @@ fun env ->
918928
let proc_mgr = Eio.Stdenv.process_mgr env in

dune

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
(package eio_main)
33
(deps (package eio_main) (env_var "EIO_BACKEND"))
44
(preludes doc/prelude.ml)
5-
(enabled_if (<> %{os_type} "Win32"))
65
(files README.md))

lib_eio_windows/dune

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
(library
22
(name eio_windows)
33
(public_name eio_windows)
4-
(library_flags :standard -ccopt -lbcrypt -ccopt -lntdll)
4+
(library_flags :standard -cclib -lbcrypt -cclib -lntdll)
55
(enabled_if (= %{os_type} "Win32"))
66
(foreign_stubs
77
(language c)
88
(include_dirs ../lib_eio/unix/include)
99
(names eio_windows_stubs eio_windows_cstruct_stubs))
10+
(c_library_flags :standard -lbcrypt -lntdll)
1011
(libraries eio eio.unix eio.utils fmt))
1112

1213
(rule

0 commit comments

Comments
 (0)