Skip to content

Commit

Permalink
refactor: simplify by using lev_fiber builtins
Browse files Browse the repository at this point in the history
Lev_fiber.Io.{stdin,stdout,stderr} are now available

ps-id: 70CD95C7-DA41-4234-B763-90C848C75D32
  • Loading branch information
rgrinberg committed Feb 6, 2022
1 parent 68895d5 commit c456e7a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
27 changes: 2 additions & 25 deletions ocaml-lsp-server/src/ocaml_lsp_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -984,31 +984,8 @@ let start () =
Server.Handler.make ~on_request ~on_notification ()
in
let* stream =
let+ stdin, stdout =
if Sys.win32 then
let* stdin =
Lev_fiber.Io.create (Lev_fiber.Fd.create Unix.stdin `Blocking) Input
in
let+ stdout =
Lev_fiber.Io.create (Lev_fiber.Fd.create Unix.stdout `Blocking) Output
in
(stdin, stdout)
else (
Unix.set_nonblock Unix.stdin;
Unix.set_nonblock Unix.stdout;
let* stdin =
Lev_fiber.Io.create
(Lev_fiber.Fd.create Unix.stdin (`Non_blocking true))
Input
in
let+ stdout =
Lev_fiber.Io.create
(Lev_fiber.Fd.create Unix.stdout (`Non_blocking true))
Output
in
(stdin, stdout)
)
in
let* stdin = Lev_fiber.Io.stdin in
let+ stdout = Lev_fiber.Io.stdout in
Lsp_fiber.Fiber_io.make stdin stdout
in
let configuration = Configuration.default in
Expand Down
2 changes: 1 addition & 1 deletion submodules/lev

0 comments on commit c456e7a

Please sign in to comment.