Update main.ml

Make `task` a function in order to catch its exceptions.
This commit is contained in:
Mathieu Barbin 2024-05-28 15:46:35 +02:00 committed by Simon Cruanes
parent 1f977ad145
commit 394d8ab0eb

View file

@ -82,11 +82,11 @@ let run () =
Eio_main.run @@ fun env -> Eio_main.run @@ fun env ->
let s = new lsp_server in let s = new lsp_server in
let server = Linol_eio.Jsonrpc2.create_stdio ~env s in let server = Linol_eio.Jsonrpc2.create_stdio ~env s in
let task = let task () =
let shutdown () = s#get_status = `ReceivedExit in let shutdown () = s#get_status = `ReceivedExit in
Linol_eio.Jsonrpc2.run ~shutdown server Linol_eio.Jsonrpc2.run ~shutdown server
in in
match task with match task () with
| () -> () | () -> ()
| exception e -> | exception e ->
let e = Printexc.to_string e in let e = Printexc.to_string e in