Skip to content

Commit

Permalink
fix(ocamllsp): fix in pp handling the file permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jboillot committed Jun 22, 2023
1 parent 1f78031 commit f092f10
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ocaml-lsp-server/src/ocaml_lsp_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -878,20 +878,20 @@ let run_in_directory ~prog ~prog_is_quoted:_ ~args ~cwd ?stdin ?stdout ?stderr
let argv = [ "sh"; "-c"; cmd ] in
let stdin =
match stdin with
| Some file -> Unix.openfile file [ Unix.O_WRONLY ] 0x664
| None -> Unix.openfile "/dev/null" [ Unix.O_RDONLY ] 0x777
| Some file -> Unix.openfile file [ Unix.O_WRONLY; Unix.O_CREAT ] 0o664
| None -> Unix.openfile "/dev/null" [ Unix.O_RDONLY ] 0o777
in
let stdout, should_close_stdout =
match stdout with
| Some file -> (Unix.openfile file [ Unix.O_WRONLY ] 0x664, true)
| Some file -> (Unix.openfile file [ Unix.O_WRONLY ] 0o664, true)
| None ->
(* Runned programs should never output to stdout since it is the channel
used by LSP to communicate with the editor *)
(Unix.stderr, false)
in
let stderr =
Option.map stderr ~f:(fun file ->
Unix.openfile file [ Unix.O_WRONLY ] 0x664)
Unix.openfile file [ Unix.O_WRONLY ] 0o664)
in
let pid =
let cwd : Spawn.Working_dir.t = Path cwd in
Expand Down

0 comments on commit f092f10

Please sign in to comment.