-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for WSL #40
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
if wsl { | ||
cmd := "cmd.exe" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linux systems under WSL ship with a wslview
utility available in PATH that can be used in place of xdg-open
. Therefore, the fix for this would be to just add wslview
as fallback to providers
above; no detection necessary nor spawning cmd.exe
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your feedback. I started a fresh install of Windows 10, and wslview
doesn't seem to exist in Linux WSL2 installations by default. However, installing WSL utilities adds wslview
and creates a symbolic link for x-www-browser
, which resolves the original issue.
$ apt install wslu
Reading package lists... Done
....
update-alternatives: using /usr/bin/wslview to provide /usr/bin/x-www-browser (x-www-browser) in auto mode
update-alternatives: using /usr/bin/wslview to provide /usr/bin/www-browser (www-browser) in auto mode
$ ls -la /usr/bin/x-www-browser
lrwxrwxrwx 1 root root 31 Aug 7 00:20 /usr/bin/x-www-browser -> /etc/alternatives/x-www-browser
$ ls -la /etc/alternatives/x-www-browser
lrwxrwxrwx 1 root root 16 Aug 7 00:20 /etc/alternatives/x-www-browser -> /usr/bin/wslview
If the implementation above is an overhead to the package, I'm happy to close the PR in favor of having wslview
utility as a required dependency in WSL installations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed dive. I see added value in your approach being compatible even if WSL utilities aren't installed, but I'm surprised that the cmd.exe
approach works. Do Linux subsystems contain a cmd.exe
in their PATH that, when executed, is connected to the host Windows system? Sorry, I'm not very experienced with WSL, and I don't have a Windows instance I can try on at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do believe that the providers
approach should be tried before the isWSL
block.
Will this feature to be continued? |
This patch adds support for Windows Subsystem for Linux.