diff --git a/status/status.go b/status/status.go index bd12e70..1246581 100644 --- a/status/status.go +++ b/status/status.go @@ -14,6 +14,7 @@ import ( "net/http" "os" "os/user" + "path/filepath" "runtime" "strings" "sync" @@ -38,8 +39,14 @@ var ( } return fmt.Sprintf("%s (uid=%s)", user.Username, user.Uid) }() - exepath, _ = os.Executable() - startTime = time.Now() + exepath, exename = func() (string, string) { + exe, _ := os.Executable() + if exe == "" { + return "(unknown)", "(unknown)" + } + return exe, filepath.Base(exe) + }() + startTime = time.Now() rootItem = &simpleItem{ baseItem: baseItem{ @@ -63,6 +70,7 @@ type statusData struct { Build string Hostname string Username string + ExeName string ExePath string PID int Compiler string @@ -191,6 +199,7 @@ func Handle(w http.ResponseWriter, r *http.Request) { Build: "TODO", Hostname: hostname, Username: username, + ExeName: exename, ExePath: exepath, PID: os.Getpid(), Compiler: runtime.Compiler, diff --git a/status/status.html.tmpl b/status/status.html.tmpl index a70711d..f3866e3 100644 --- a/status/status.html.tmpl +++ b/status/status.html.tmpl @@ -10,7 +10,7 @@ - Status + Status for {{.ExeName}} -

Status

+

Status for {{.ExeName}}

{{.ExePath}}
Started at {{.StartTime}} ({{.StartTimeAgo}} ago)
diff --git a/status/status_test.go b/status/status_test.go index 4fda0e2..796c048 100644 --- a/status/status_test.go +++ b/status/status_test.go @@ -47,6 +47,7 @@ func TestSmokeStatusTemplate(t *testing.T) { Build: "1234", Hostname: hostname, Username: username, + ExeName: exename, ExePath: exepath, PID: os.Getpid(), Compiler: runtime.Compiler,