Conversation
| } | ||
|
|
||
| if wsl { | ||
| cmd := "cmd.exe" |
There was a problem hiding this comment.
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.
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.
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.
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.