Check if wslview exists and use it over xdg-open for WSL2
This commit is contained in:
parent
78203515fd
commit
7f83927fd2
|
@ -9,8 +9,8 @@ import (
|
||||||
|
|
||||||
func getBrowserCmd(url string) *exec.Cmd {
|
func getBrowserCmd(url string) *exec.Cmd {
|
||||||
// Check for Windows Subsystem for Linux (v2+).
|
// Check for Windows Subsystem for Linux (v2+).
|
||||||
if os.Getenv("WSL_DISTRO_NAME") != "" {
|
if _, err := os.Stat("/usr/bin/wslview"); err == nil {
|
||||||
return exec.Command("rundll32.exe", "url.dll,FileProtocolHandler", url)
|
return exec.Command("wslview", url)
|
||||||
}
|
}
|
||||||
|
|
||||||
return exec.Command("xdg-open", url)
|
return exec.Command("xdg-open", url)
|
||||||
|
|
Loading…
Reference in New Issue