mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 02:52:46 +08:00
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"
This commit is contained in:
parent
f6e3f4db34
commit
8e3e50f9ee
|
@ -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]
|
||||
|
|
Loading…
Reference in New Issue
Block a user