linol/submodules/lev/lev-fiber/test/process.ml
Simon Cruanes 7fbc187548 Squashed 'thirdparty/lsp/' content from commit aae69863
git-subtree-dir: thirdparty/lsp
git-subtree-split: aae6986391a8519de3da6a7a341f2bd3376e0d2f
2025-04-10 15:44:25 -04:00

18 lines
563 B
OCaml

open Stdune
open Fiber.O
let%expect_test "wait for simple process" =
let stdin, stdin_w = Unix.pipe () in
let stdout_r, stdout = Unix.pipe () in
let stderr_r, stderr = Unix.pipe () in
Unix.close stdin_w;
Unix.close stdout_r;
Unix.close stderr_r;
Lev_fiber.run (fun () ->
let pid = Unix.create_process "true" [| "true" |] stdin stdout stderr in
let+ status = Lev_fiber.waitpid ~pid in
match status with
| WEXITED n -> printfn "status: %d" n
| _ -> assert false)
|> Lev_fiber.Error.ok_exn;
[%expect {| status: 0 |}]