From 7f83927fd2baa602b413d99bcebfae40f301e1ed Mon Sep 17 00:00:00 2001 From: Johan Westling Date: Thu, 23 Jul 2020 10:05:11 +0300 Subject: [PATCH] Check if wslview exists and use it over xdg-open for WSL2 --- cmd/cloudflared/shell/launch_browser_unix.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/cloudflared/shell/launch_browser_unix.go b/cmd/cloudflared/shell/launch_browser_unix.go index 519c0999..2ebe9590 100644 --- a/cmd/cloudflared/shell/launch_browser_unix.go +++ b/cmd/cloudflared/shell/launch_browser_unix.go @@ -9,8 +9,8 @@ import ( 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) + if _, err := os.Stat("/usr/bin/wslview"); err == nil { + return exec.Command("wslview", url) } return exec.Command("xdg-open", url)