Commit d580972d authored by Chris Broadfoot's avatar Chris Broadfoot

cmd/internal/browser: use xdg-open only from a desktop session

xdg-open's man page says:
> xdg-open is for use inside a desktop session only.

Use the DISPLAY environment variable to detect this.

Updates #19131.

Change-Id: I3926b3e1042393939b2ec6aacd9b63ac8192df3b
Reviewed-on: https://go-review.googlesource.com/37390Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
parent 731fd009
...@@ -23,7 +23,10 @@ func Commands() [][]string { ...@@ -23,7 +23,10 @@ func Commands() [][]string {
case "windows": case "windows":
cmds = append(cmds, []string{"cmd", "/c", "start"}) cmds = append(cmds, []string{"cmd", "/c", "start"})
default: default:
cmds = append(cmds, []string{"xdg-open"}) if os.Getenv("DISPLAY") != "" {
// xdg-open is only for use in a desktop environment.
cmds = append(cmds, []string{"xdg-open"})
}
} }
cmds = append(cmds, cmds = append(cmds,
[]string{"chrome"}, []string{"chrome"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment