From aba62c22110e13fb1a5da242568ea887a59d5f33 Mon Sep 17 00:00:00 2001 From: Christopher Phillips Date: Mon, 8 Aug 2022 14:08:06 -0400 Subject: [PATCH] add safe $PATH lookup; update powershell regex --- share/functions/help.fish | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/share/functions/help.fish b/share/functions/help.fish index 759bcde6e..86d07234c 100644 --- a/share/functions/help.fish +++ b/share/functions/help.fish @@ -89,7 +89,9 @@ function help --description 'Show help for the fish shell' # 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 + and set -l cmd (command -s powershell.exe cmd.exe /mnt/c/Windows/System32/cmd.exe) + # Use the first of these. + set fish_browser $cmd[1] end if type -q wsl-open @@ -231,13 +233,9 @@ function help --description 'Show help for the fish shell' end # cmd.exe and powershell needs more coaxing. - if string match -qr 'cmd\.exe$' -- $fish_browser[1] + if string match -qr 'powershell\.exe$|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] case htmlview x-www-browser