Skip to content

Commit cd92ce4

Browse files
committed
Support OCaml 5 new Unix primitive names
1 parent a3c5c45 commit cd92ce4

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/unix/dune

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ let preprocess =
88

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

11+
(rule
12+
(targets lwt_process.ml)
13+
(deps (:ml lwt_process.cppo.ml))
14+
(action
15+
(chdir %{project_root}
16+
(run %{bin:cppo} -V OCAML:%{ocaml_version} %{ml} -o %{targets}))))
17+
1118
(rule
1219
(targets lwt_unix.ml)
1320
(deps (:ml lwt_unix.cppo.ml))
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ let unix_redirect fd redirection = match redirection with
136136
Unix.dup2 fd' fd;
137137
Unix.close fd'
138138

139+
#if OCAML_VERSION >= (5, 0, 0)
140+
external unix_exit : int -> 'a = "caml_unix_exit"
141+
#else
139142
external unix_exit : int -> 'a = "unix_exit"
143+
#endif
140144

141145
let unix_spawn
142146
?cwd

src/unix/lwt_unix.cppo.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,11 @@ let wait () = waitpid [] (-1)
24342434

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

2437+
#if OCAML_VERSION >= (5, 0, 0)
2438+
external unix_exit : int -> 'a = "caml_unix_exit"
2439+
#else
24372440
external unix_exit : int -> 'a = "unix_exit"
2441+
#endif
24382442

24392443
let system cmd =
24402444
if Sys.win32 then

0 commit comments

Comments
 (0)