Skip to content

Commit

Permalink
Do not use stdout for logs if server.mode is stdio
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Jan 11, 2024
1 parent 9135222 commit 05d9cce
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/util/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,11 @@ let make ?(input=stdin) ?(output=stdout) file : t =
}

let bind () =
let mode = GobConfig.get_string "server.mode" in
if mode = "stdio" then None, None else (
match GobConfig.get_string "server.mode" with
| "stdio" ->
Logs.Result.use_stdout := false;
(None, None)
| "unix" ->
let path = GobConfig.get_string "server.unix-socket" in
if Sys.file_exists path then
Sys.remove path;
Expand All @@ -183,7 +186,8 @@ let bind () =
let conn, _ = Unix.accept socket in
Unix.close socket;
Sys.remove path;
Some (Unix.input_of_descr conn), Some (Unix.output_of_descr conn))
(Some (Unix.input_of_descr conn), Some (Unix.output_of_descr conn))
| _ -> assert false

let start file =
let input, output = bind () in
Expand Down

0 comments on commit 05d9cce

Please sign in to comment.