Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.11.6

- Stop leaking file descriptors like a sieve (#701)

# 1.11.5

- Fix process termination. Once the lsp server is stepped, the process will
Expand Down
11 changes: 6 additions & 5 deletions ocaml-lsp-server/src/dune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -366,19 +366,20 @@ end = struct
| `Unix s -> Unix.ADDR_UNIX s
| `Ip (`Host h, `Port p) -> Unix.ADDR_INET (Unix.inet_addr_of_string h, p)
in
let sock =
let domain = Unix.domain_of_sockaddr sockaddr in
let socket = Unix.socket ~cloexec:true domain Unix.SOCK_STREAM 0 in
Lev_fiber.Fd.create socket (`Non_blocking false)
in
let* session =
let sock =
let domain = Unix.domain_of_sockaddr sockaddr in
let socket = Unix.socket ~cloexec:true domain Unix.SOCK_STREAM 0 in
Lev_fiber.Fd.create socket (`Non_blocking false)
in
Fiber.map_reduce_errors
(module Monoid.List (Exn_with_backtrace))
~on_error:(fun exn -> Fiber.return [ exn ])
(fun () -> Csexp_rpc.connect sock sockaddr)
in
match session with
| Error exns ->
Lev_fiber.Fd.close sock;
let message =
let exn = List.hd exns in
Format.asprintf "unable to connect to dune %s@.%a"
Expand Down