Added WSL2 check to unix browser launcher

This commit is contained in:
Johan Westling 2020-07-23 08:20:25 +03:00
parent 8836ee1dda
commit 78203515fd
1 changed files with 6 additions and 0 deletions

View File

@ -3,9 +3,15 @@
package shell
import (
"os"
"os/exec"
)
func getBrowserCmd(url string) *exec.Cmd {
// Check for Windows Subsystem for Linux (v2+).
if os.Getenv("WSL_DISTRO_NAME") != "" {
return exec.Command("rundll32.exe", "url.dll,FileProtocolHandler", url)
}
return exec.Command("xdg-open", url)
}