Use system web browser under WSL

Launch `cmd.exe /c "start URL"` under WSL for both `fish_config` and
`help`. This works around #4299 but does not address the underlying
issue (#1132).
This commit is contained in:
Mahmoud Al-Qudsi
2018-04-02 18:36:11 -05:00
parent 358e9def5b
commit 99ecaec175
2 changed files with 18 additions and 1 deletions

View File

@@ -119,6 +119,11 @@ function help --description 'Show help for the fish shell'
set fish_help_page "index.html"
end
set -l wsl 0
if uname -a | string match -qr Microsoft
set wsl 1
end
set -l page_url
if test -f $__fish_help_dir/index.html
# Help is installed, use it
@@ -150,8 +155,10 @@ function help --description 'Show help for the fish shell'
end
end
if test $wsl -eq 1
cmd.exe /c "start $page_url"
# If browser is known to be graphical, put into background
if contains -- $fish_browser[1] $graphical_browsers
else if contains -- $fish_browser[1] $graphical_browsers
switch $fish_browser[1]
case 'htmlview' 'x-www-browser'
printf (_ 'help: Help is being displayed in your default browser.\n')