forked from hswaw/hscloud
go/statusz: do not crash on failure to resolve uid
This can happen if a binary is built statically and fails to load libgcc/nsd libraries at runtime. Change-Id: Ia76645471b83a6cc75fe6552e70e6a251b50129c
This commit is contained in:
parent
99ce53c79a
commit
376f58720e
1 changed files with 5 additions and 2 deletions
|
@ -38,6 +38,7 @@ import (
|
|||
"html"
|
||||
"html/template"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/user"
|
||||
|
@ -197,9 +198,11 @@ func init() {
|
|||
|
||||
user, err := user.Current()
|
||||
if err != nil {
|
||||
glog.Fatalf("user.Current: %v", err)
|
||||
log.Printf("user.Current: %v", err)
|
||||
username = "UNKNOWN"
|
||||
} else {
|
||||
username = fmt.Sprintf("%s (%s)", user.Username, user.Uid)
|
||||
}
|
||||
username = fmt.Sprintf("%s (%s)", user.Username, user.Uid)
|
||||
|
||||
exec, err := os.Executable()
|
||||
if err == nil {
|
||||
|
|
Loading…
Reference in a new issue