1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:44:48 -07:00

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/37390
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Chris Broadfoot 2017-02-22 15:48:38 -08:00
parent 731fd009f0
commit d580972d59

View File

@ -23,7 +23,10 @@ func Commands() [][]string {
case "windows":
cmds = append(cmds, []string{"cmd", "/c", "start"})
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,
[]string{"chrome"},