browser list used for invokeVisualizer needs be rethought
- Dominant language
- Go
- Stars
- 9.3k
- Forks
- 671
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 10
Description
pprof invokes web browsers when the output of the command (e.g. web or weblist)
needs to be visualized in a web browser.
golang/go#25853 exhibited a couple of issues around the browser invocation logic.
1) the list of browsers populated in [browsers](https://github.com/google/pprof/blob/8b03ce837f3401233d4e32de3a5f0ea3ff1c13c2/internal/driver/commands.go#L339 ) needs to be rethought.
If there is BROWSER env var set, I think it should be picked as the first choice. Currently, not.
FYI, go's [cmd/internal/browser](https://github.com/golang/go/blob/46076c37578fba9b49059584ef896099c9240fb2/src/cmd/internal/browser/browser.go#L18) package has an implementation for the similar purpose.
Also, note that commands like chrome or google-chrome are not used on Mac. If they exist, they are likely not the browser command we expect.
2) [invokeVisualize](https://github.com/google/pprof/blob/8b03ce837f3401233d4e32de3a5f0ea3ff1c13c2/internal/driver/commands.go#L422) returns once the command binary is located and can launch a process.
The command's stderr is directed to the pprof's stderr so users could be able to see the error message but *only if* the command outputs the error message to stderr. I don't know what's the best way to deal with it. Will it be useful if the tool prints out the exact command? Or, wait for a second, and if the process seems to exit with error code already, try again?
Contributor guide
Assessment
This issue has not been assessed yet.