I found the following problem in this simple code:
let () = print_endline "Hello"; print_endline (Unix.getlogin ())
Running normally with ./a.out gives:
Hello ricardo
But working as ./a.out </dev/null makes Unix.getlogin fail:
Hello Fatal error: exception Unix.Unix_error(20, "getlogin", "")
Any idea why this is happening?
source share