mirror of
https://github.com/c-cube/linol.git
synced 2025-12-05 19:00:34 -05:00
bring back Linol_eio.spawn for logging uncaught exceptions
This commit is contained in:
parent
40843b81db
commit
705cc47ddf
2 changed files with 11 additions and 1 deletions
|
|
@ -45,7 +45,7 @@ class lsp_server ~(sw: Eio.Switch.t) =
|
||||||
val buffers : (Lsp.Types.DocumentUri.t, state_after_processing) Hashtbl.t =
|
val buffers : (Lsp.Types.DocumentUri.t, state_after_processing) Hashtbl.t =
|
||||||
Hashtbl.create 32
|
Hashtbl.create 32
|
||||||
|
|
||||||
method spawn_query_handler f = Eio.Fiber.fork ~sw f
|
method spawn_query_handler f = Linol_eio.spawn ~sw f
|
||||||
|
|
||||||
(* We define here a helper method that will:
|
(* We define here a helper method that will:
|
||||||
- process a document
|
- process a document
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,16 @@ module IO_eio :
|
||||||
let read_line in_ch = Eio.Buf_read.line in_ch
|
let read_line in_ch = Eio.Buf_read.line in_ch
|
||||||
end
|
end
|
||||||
|
|
||||||
|
(** Spawn function. *)
|
||||||
|
let spawn ~sw f =
|
||||||
|
Eio.Fiber.fork ~sw (fun () ->
|
||||||
|
try
|
||||||
|
f ()
|
||||||
|
with exn ->
|
||||||
|
Printf.eprintf "uncaught exception in `spawn`:\n%s\n%!"
|
||||||
|
(Printexc.to_string exn);
|
||||||
|
raise exn)
|
||||||
|
|
||||||
include Lsp.Types
|
include Lsp.Types
|
||||||
include IO_eio
|
include IO_eio
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue