From 8e3e50f9ee7c8be1b5391d528d662a7090c9a88b Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Sat, 6 Aug 2022 13:30:16 -0400 Subject: [PATCH] Add powershell support to suppress UNC path error Prefer using powershell.exe over cmd.exe on wsl to supress terminal error: "CMD.EXE was started with the above path as the current directory" --- share/functions/help.fish | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/share/functions/help.fish b/share/functions/help.fish index a9c0c5049..c2f2fc025 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -86,6 +86,12 @@ function help --description 'Show help for the fish shell' set fish_browser $cmd[1] end + # Try and see if powershell.exe is an option to avoid UNC path error + # https://ss64.com/nt/cmd.html Launching CMD/batch files from a UNC path + if type -q powershell.exe + set fish_browser powershell.exe + end + if type -q wsl-open set fish_browser wsl-open end @@ -224,10 +230,13 @@ function help --description 'Show help for the fish shell' end end - # cmd.exe needs more coaxing. + # cmd.exe and powershell needs more coaxing. if string match -qr 'cmd\.exe$' -- $fish_browser[1] # The space before the /c is to prevent msys2 from expanding it to a path $fish_browser " /c" start $page_url + else if string match -qr 'powershell\.exe$' -- $fish_browser[1] + # The space before the /c is to prevent msys2 from expanding it to a path + $fish_browser " /c" start $page_url # If browser is known to be graphical, put into background else if contains -- $fish_browser[1] $graphical_browsers switch $fish_browser[1]