Skip to content

Commit

Permalink
Work around getlogin failing for lwt
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Trakhman committed Feb 7, 2019
1 parent 89a3839 commit 5306a57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pgx_lwt/src/pgx_lwt.ml
Expand Up @@ -52,7 +52,11 @@ module Thread = struct
Unix.ADDR_INET (addr, port))
>>= Lwt_io.open_connection

let getlogin = Lwt_unix.getlogin
(* The unix getlogin syscall can fail *)
let getlogin () =
Unix.getuid ()
|> Lwt_unix.getpwuid
>|= fun { Lwt_unix.pw_name ; _ } -> pw_name

let debug = Lwt_io.eprintl

Expand Down
2 changes: 2 additions & 0 deletions pgx_unix/src/pgx_unix.ml
Expand Up @@ -54,6 +54,8 @@ module Simple_thread = struct
let input_binary_int = input_binary_int
let really_input = really_input
let close_in = close_in

(* The unix getlogin syscall can fail *)
let getlogin () =
Unix.getuid ()
|> Unix.getpwuid
Expand Down

0 comments on commit 5306a57

Please sign in to comment.