Skip to content

Commit e589c37

Browse files
authored
Merge pull request #5292 from dpandhi-git/master
dashboard: When run as root, show URL instead of opening browser
2 parents 35cfb7e + 814c8e1 commit e589c37

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/minikube/cmd/dashboard.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"net/http"
2424
"os"
2525
"os/exec"
26+
"os/user"
2627
"regexp"
2728
"time"
2829

@@ -128,7 +129,12 @@ var dashboardCmd = &cobra.Command{
128129
exit.WithCodeT(exit.Unavailable, "{{.url}} is not accessible: {{.error}}", out.V{"url": url, "error": err})
129130
}
130131

131-
if dashboardURLMode {
132+
//check if current user is root
133+
user, err := user.Current()
134+
if err != nil {
135+
exit.WithError("Unable to get current user", err)
136+
}
137+
if dashboardURLMode || user.Uid == "0" {
132138
out.Ln(url)
133139
} else {
134140
out.T(out.Celebrate, "Opening {{.url}} in your default browser...", out.V{"url": url})

0 commit comments

Comments
 (0)