Skip to content

Commit

Permalink
Fix user query when using libc implementation of os/user
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Oct 18, 2022
1 parent e4fa885 commit 4ffe1c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions os.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ func init() {
if err != nil {
log.Printf("user: %s", err)
if os.Getenv("HOME") == "" {
log.Print("$HOME variable is empty or not set")
panic("$HOME variable is empty or not set")
}
if os.Getenv("USER") == "" {
log.Print("$USER variable is empty or not set")
panic("$USER variable is empty or not set")
}
u = &user.User{
Username: os.Getenv("USER"),
HomeDir: os.Getenv("HOME"),
}
}
gUser = u
Expand Down

0 comments on commit 4ffe1c4

Please sign in to comment.