Skip to content
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

Support WSL without requiring wslview or xdg-open #21

Open
Seeker14491 opened this issue Mar 27, 2023 · 5 comments
Open

Support WSL without requiring wslview or xdg-open #21

Seeker14491 opened this issue Mar 27, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@Seeker14491
Copy link
Owner

Currently on WSL we require either wslview or xdg-open to be available on the system, but there are WSL distros that don't include either preinstalled.

@Seeker14491 Seeker14491 added the enhancement New feature or request label Mar 27, 2023
@bugadani
Copy link

Hi! Since this issue is about enhancing WSL support, I think this comment may be relevant here so I don't open a separate issue.

I just found your crate (I'm trying to open some generated stuff from WSL(2) and I've been reading a lot of cargo src to see how it opens docs) and it looks like open() has regressed in 0.6. With 0.5.2, I'm able to open a document in my browser, but the same code does not work on 0.6.

@Seeker14491
Copy link
Owner Author

What is your wslu version (run wslview --version)? I think there were some relevant bug fixes in v4.1.0.

@bugadani
Copy link

bugadani commented Mar 28, 2023

$> wslview --version
wslu v2.3.6; wslview v06

This is an Ubuntu 20.04 that hasn't been updated in ages, to be honest.

@Seeker14491
Copy link
Owner Author

Yeah, that version is 3+ years old. The current version works properly, though I would like to avoid regressions for people using older versions if possible.

@tgross35
Copy link

tgross35 commented Dec 7, 2023

This doesn't seem like it would be too bad. The file is pretty simple, and wslview --verbose ... tells you exactly what it is doing. Link: https://github.com/wslutilities/wslu/blob/b6fa4b70b22909337cb13b5b2ea9845f733f60ff/src/wslview.sh

E.g. wslview --verbose http://google.com just calls powershell

/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive $'\342\200\223ExecutionPolicy' Bypass -Command '[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding(437); Start' '"http://google.com"'

And opening a file:

/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive $'\342\200\223ExecutionPolicy' Bypass -Command '[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding(437); Start' '"\\wsl$\Ubuntu"'

Opening a html file in browser just works

/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -NoProfile -NonInteractive $'\342\200\223ExecutionPolicy' Bypass -Command '[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; [Console]::InputEncoding = [System.Text.Encoding]::GetEncoding(437); Start' '"\\wsl$\Ubuntu\home\tmgross\foo\target\doc\foo\index.html"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants