os.rb: fix for WSL systems without wslview

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Maxim Belkin 2023-03-02 15:54:37 +00:00
parent 5dbf95958b
commit 3e6fc271c4

View File

@ -69,7 +69,11 @@ module OS
elsif OS.linux?
require "os/linux"
ISSUES_URL = "https://docs.brew.sh/Troubleshooting"
PATH_OPEN = (OS::Linux.wsl? ? "wslview" : "xdg-open").freeze
PATH_OPEN = if OS::Linux.wsl? && (wslview = which("wslview").presence)
wslview.to_s
else
"xdg-open"
end.freeze
end
sig { returns(T::Boolean) }