[go] cmd/pprof: run $BROWSER and system browser before Chrome

61 views
Skip to first unread message

Russ Cox (Gerrit)

unread,
Jul 14, 2015, 7:05:00 PM7/14/15
to Ian Lance Taylor, Russ Cox, golang-co...@googlegroups.com
Russ Cox uploaded a change:
https://go-review.googlesource.com/12201

cmd/pprof: run $BROWSER and system browser before Chrome

Fixes #10259.

Change-Id: Ica6b8301cc8291785a3c496fb513050813b2d8df
---
M src/cmd/pprof/internal/commands/commands.go
1 file changed, 5 insertions(+), 1 deletion(-)



diff --git a/src/cmd/pprof/internal/commands/commands.go
b/src/cmd/pprof/internal/commands/commands.go
index 167e57f..175c7cc 100644
--- a/src/cmd/pprof/internal/commands/commands.go
+++ b/src/cmd/pprof/internal/commands/commands.go
@@ -82,7 +82,10 @@
// browsers returns a list of commands to attempt for web visualization
// on the current platform
func browsers() []string {
- cmds := []string{"chrome", "google-chrome", "firefox"}
+ var cmds []string
+ if exe := os.Getenv("BROWSER"); exe != "" {
+ cmds = append(cmds, exe)
+ }
switch runtime.GOOS {
case "darwin":
cmds = append(cmds, "/usr/bin/open")
@@ -91,6 +94,7 @@
default:
cmds = append(cmds, "xdg-open")
}
+ cmds = append(cmds, "chrome", "google-chrome", "firefox")
return cmds
}


--
https://go-review.googlesource.com/12201

Andrew Gerrand (Gerrit)

unread,
Jul 14, 2015, 7:10:25 PM7/14/15
to Russ Cox, golang-co...@googlegroups.com
Andrew Gerrand has posted comments on this change.

cmd/pprof: run $BROWSER and system browser before Chrome

Patch Set 1: Code-Review+2

--
https://go-review.googlesource.com/12201
Gerrit-Reviewer: Andrew Gerrand <a...@golang.org>
Gerrit-HasComments: No

Russ Cox (Gerrit)

unread,
Jul 15, 2015, 12:30:39 AM7/15/15
to Russ Cox, golang-...@googlegroups.com, Andrew Gerrand, golang-co...@googlegroups.com
Russ Cox has submitted this change and it was merged.

cmd/pprof: run $BROWSER and system browser before Chrome

Fixes #10259.

Change-Id: Ica6b8301cc8291785a3c496fb513050813b2d8df
Reviewed-on: https://go-review.googlesource.com/12201
Reviewed-by: Andrew Gerrand <a...@golang.org>
---
M src/cmd/pprof/internal/commands/commands.go
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
Andrew Gerrand: Looks good to me, approved


--
https://go-review.googlesource.com/12201
Gerrit-Reviewer: Andrew Gerrand <a...@golang.org>
Gerrit-Reviewer: Russ Cox <r...@golang.org>

Ralph Corderoy (Gerrit)

unread,
Jul 15, 2015, 7:09:04 AM7/15/15
to Russ Cox, Andrew Gerrand, golang-co...@googlegroups.com
Ralph Corderoy has posted comments on this change.

cmd/pprof: run $BROWSER and system browser before Chrome

Patch Set 3:

(1 comment)

https://go-review.googlesource.com/#/c/12201/3/src/cmd/pprof/internal/commands/commands.go
File src/cmd/pprof/internal/commands/commands.go:

Line 87: cmds = append(cmds, exe)
Is $BROWSER simply the command to run?
When Eric Raymond proposed it, he made it a PATH-like list to try,
http://www.catb.org/esr/BROWSER/index.html
and this is what Python, for example, does
https://hg.python.org/cpython/file/a4fe32477df6/Lib/webbrowser.py#l708
https://docs.python.org/3/library/webbrowser.html


--
https://go-review.googlesource.com/12201
Gerrit-Reviewer: Andrew Gerrand <a...@golang.org>
Gerrit-Reviewer: Ralph Corderoy <ralph.c...@gmail.com>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-HasComments: Yes
Reply all
Reply to author
Forward
0 new messages