diff --git a/.merlin b/.merlin index d70877425e..b5c20f1954 100644 --- a/.merlin +++ b/.merlin @@ -1,7 +1,7 @@ EXT lwt S async -S cohttp +S lib S lib_test S examples/async S lwt @@ -25,11 +25,12 @@ PKG ipaddr.unix PKG conduit PKG conduit.async PKG conduit.lwt +PKG cmdliner B _build/ B _build/lwt B _build/lib_test B _build/async -B _build/cohttp +B _build/lib B _build/examples/async B _build/bin \ No newline at end of file diff --git a/bin/cohttp_server_lwt.ml b/bin/cohttp_server_lwt.ml index b911b1ec9b..bab306d837 100644 --- a/bin/cohttp_server_lwt.ml +++ b/bin/cohttp_server_lwt.ml @@ -168,10 +168,12 @@ let arglist = [ let _ = try Arg.parse arglist (fun x -> rest := x :: !rest) usage; - begin match !rest with - | [] -> Lwt_unix.run (start_server "." !port !host !index !verbose !ssl_cert !ssl_key ()) - | dir::_ -> Lwt_unix.run (start_server dir !port !host !index !verbose !ssl_cert !ssl_key ()) - end + let dir = + match !rest with + | [] -> "." + | dir::_ -> dir in + Lwt_main.run ( + start_server dir !port !host !index !verbose !ssl_cert !ssl_key ()) with | Failure s -> print_endline s | Sys_error s -> print_endline s diff --git a/lib_test/test_net_lwt.ml b/lib_test/test_net_lwt.ml index aca90f41f0..8194fa2d42 100644 --- a/lib_test/test_net_lwt.ml +++ b/lib_test/test_net_lwt.ml @@ -68,7 +68,7 @@ let test_cases = make_net_req "https://github.com/"; make_net_reqv; ] in - List.map (fun x -> "test" >:: (fun () -> Lwt_unix.run (x ()))) tests + List.map (fun x -> "test" >:: (fun () -> Lwt_main.run (x ()))) tests (* Returns true if the result list contains successes only. Copied from oUnit source as it isnt exposed by the mli *) diff --git a/lib_test/test_net_lwt_client_and_server.ml b/lib_test/test_net_lwt_client_and_server.ml index 39f6e96da7..521e5deced 100644 --- a/lib_test/test_net_lwt_client_and_server.ml +++ b/lib_test/test_net_lwt_client_and_server.ml @@ -122,7 +122,7 @@ let _ = |0 -> (* child / client *) Unix.sleep 2; Printf.eprintf "client is %d\n%!" (Unix.getpid ()); - Lwt_unix.run (client ()) + Lwt_main.run (client ()) |pid -> (* parent / server *) Printf.eprintf "server is %d\n%!" (Unix.getpid ()); - Lwt_unix.run (make_server ()) + Lwt_main.run (make_server ()) diff --git a/lib_test/test_net_lwt_google.ml b/lib_test/test_net_lwt_google.ml index fda654a7b2..928174ca9a 100644 --- a/lib_test/test_net_lwt_google.ml +++ b/lib_test/test_net_lwt_google.ml @@ -3,7 +3,7 @@ let body = (* you can paste this into utop to interactively mess around *) (* do a #require "cohttp.lwt" first *) let open Cohttp_lwt_unix in - Lwt_unix.run ( + Lwt_main.run ( Client.get Uri.(of_string "http://www.google.com/") >>= fun (r,b) -> Cohttp_lwt_body.to_string b ) diff --git a/lib_test/test_net_lwt_google_custom_ctx.ml b/lib_test/test_net_lwt_google_custom_ctx.ml index 6f2bf78247..797f2dfc22 100644 --- a/lib_test/test_net_lwt_google_custom_ctx.ml +++ b/lib_test/test_net_lwt_google_custom_ctx.ml @@ -33,7 +33,7 @@ let () = let ctx = Cohttp_lwt_unix.Client.custom_ctx ~resolver () in let fetch uri = - Lwt_unix.run ( + Lwt_main.run ( Cohttp_lwt_unix.Client.get ~ctx (Uri.of_string uri) >>= fun (r,b) -> Cohttp_lwt_body.to_string b diff --git a/lib_test/test_net_lwt_server.ml b/lib_test/test_net_lwt_server.ml index f4b6383410..8cd050e05a 100644 --- a/lib_test/test_net_lwt_server.ml +++ b/lib_test/test_net_lwt_server.ml @@ -103,4 +103,4 @@ let make_server () = let t2 = Server.create ~ctx ~mode:ssl_mode config in t1 <&> t2 -let _ = Lwt_unix.run (make_server ()) +let _ = Lwt_main.run (make_server ()) diff --git a/lib_test/test_parser.ml b/lib_test/test_parser.ml index b18182d9e6..8f0c2f59a2 100644 --- a/lib_test/test_parser.ml +++ b/lib_test/test_parser.ml @@ -296,7 +296,7 @@ let test_cases = "mutate_simple_req", mutate_simple_req; "make_simple_res", make_simple_res; ] in - List.map (fun (n,x) -> n >:: (fun () -> Lwt_unix.run (x ()))) tests + List.map (fun (n,x) -> n >:: (fun () -> Lwt_main.run (x ()))) tests (* Returns true if the result list contains successes only. Copied from oUnit source as it isnt exposed by the mli *)