Skip to content

Commit

Permalink
Support OCaml 5 new Unix primitive names
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Jun 13, 2022
1 parent ff9416d commit a61aaef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/unix/dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ let preprocess =

let () = Jbuild_plugin.V1.send @@ {|

(rule
(targets lwt_process.ml)
(deps (:ml lwt_process.cppo.ml))
(action
(chdir %{project_root}
(run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets}))))

(rule
(targets lwt_unix.ml)
(deps (:ml lwt_unix.cppo.ml))
Expand Down
4 changes: 4 additions & 0 deletions src/unix/lwt_process.ml → src/unix/lwt_process.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ let unix_redirect fd redirection = match redirection with
Unix.dup2 fd' fd;
Unix.close fd'

#if OCAML_VERSION >= (5, 0, 0)
external unix_exit : int -> 'a = "caml_unix_exit"
#else
external unix_exit : int -> 'a = "unix_exit"
#endif

let unix_spawn
?cwd
Expand Down
4 changes: 4 additions & 0 deletions src/unix/lwt_unix.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,11 @@ let wait () = waitpid [] (-1)

external system_job : string -> int job = "lwt_unix_system_job"

#if OCAML_VERSION >= (5, 0, 0)
external unix_exit : int -> 'a = "caml_unix_exit"
#else
external unix_exit : int -> 'a = "unix_exit"
#endif

let system cmd =
if Sys.win32 then
Expand Down

0 comments on commit a61aaef

Please sign in to comment.