We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa77765 commit 2d60206Copy full SHA for 2d60206
browser_linux.go
@@ -1,9 +1,26 @@
1
package browser
2
3
-import "os/exec"
+import (
4
+ "errors"
5
+ "os/exec"
6
+)
7
8
func openBrowser(url string) error {
- return runCmd("xdg-open", url)
9
+ browserPath, err := lookPath("xdg-open", "wslview")
10
+ if err != nil {
11
+ return err
12
+ }
13
+ return runCmd(browserPath, url)
14
+}
15
+
16
+func lookPath(cmdName, fallbackName string) (string, error) {
17
+ cmdPath, err := exec.LookPath(cmdName)
18
+ if errors.Is(err, exec.ErrNotFound) {
19
+ if wslPath, err := exec.LookPath(fallbackName); err == nil {
20
+ return wslPath, nil
21
22
23
+ return cmdPath, err
24
}
25
26
func setFlags(cmd *exec.Cmd) {}
0 commit comments