summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib-unix/common/fork_cleanup.ml
blob: 0206c01b03921f7da033f6af8e62203bb04a4083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(* TEST
 include unix;
 hasunix;
 not-windows;
 {
   bytecode;
 }{
   native;
 }
*)

(* this test checks that the domain lock is properly reinitialized
   in the child process after fork.
   See: https://github.com/ocaml-multicore/ocaml-multicore/issues/471 *)

let () =
  let fd = Unix.dup Unix.stdout in
  let ret = Unix.fork () in
  if ret = 0 then
    Unix.close fd
  else
    print_endline "OK"