-
Notifications
You must be signed in to change notification settings - Fork 899
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
rustup doc does not work on Windows/WSL #2206
Comments
WSL is, as far as Rustup is concerned, Linux. As such, it's using the xdg-open embedded in the |
We could sniff the kernel to detect WSLv1, but that won't help on WSLv2. I am not sure how to detect WSLv2 at this point. Perhaps there will be an lsb-release metadata tag of some sort. I think the BROWSER command here is the problem: firefox.exe isn't a wsl-aware command. I suggest making a firefox wrapper script within WSL itself that:
|
As kinnison said, the opener crate is currently oblivious to WSL and so just uses xdg-open like any other Linux. While the open node package (which opener took inspiration from) has checks for WSL, I'm not sure that's the right approach. Perhaps it is xdg-open which should support WSL, like what's proposed in this patch. |
For what it's worth, the patch @Seeker14491 linked for xdg-open was originally reported Dec 2018, so chances it is going to get fixed there seem low. |
@kobenauf It seems to me that it'd be up to the WSL distributions to realise they're on WSL/WSL2 and locally patch their |
This, but RIIR.
Or WSL users can (and do) swap out their This is unrelated to MIcrosoft/WSL#4649. There is some navel gazing in #3907, others. Another option is to have |
Well currently users can't just swap out their |
Okay got it. Users not only can swap their @kinnison's suggestion is workable.
Yes, there's a large(ish) community using native
Counting on the Great to see out-of-the box would-be-niceness for WSL being entertained. Big 👍 |
How does invoking the non-WSL binary work? Does it show up in a recognisable path? We could do path normalisation things if (pseudo code):
|
It's a
That's a good question, and the answer is "not necessarily". There are options controlled by And... even if users haven't futzed the This is one reason spawning
I assume implied here is trying to do a All that said there isn't anything (strictly-speaking) incorrect with the psudocode. Left undrescribed is how All of which is doable. Alternately something like:
Noting deliberate absence of |
If the system |
That's the standard operating procedure (if there is such a thing). WSL users wrap their |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Example solution I came up with:
Write this bash to a script (e.g. |
That's an interesting approach, and much closer to logic that |
The |
@kinnison definitely. I think this approach could work, but I'm thinking instead we first check if there is a system I'm additionally considering introducing a second API function to the |
@rustbot label: +O-windows +O-linux |
Any progress on this PR? |
@DesmondWillowbrook I'm afraid we're beholden to someone providing @Seeker14491 with the help needed to get the |
kind of tricky, but it works well, thanks a lot !!! |
If you're in Windows11 with wslg, then just install firefox in your WSL Ubuntu, and run "rustup doc". The wslg will open the firefox brower in WSL with the right content for you. Works like a charm! |
Why dont open rustdoc in a server like |
Dear all, I found an easy way to solve this question. Adding the prompt below in .zshrc or .bashrc:
It works for me. Maybe you should alter the real executing path of browser. ❤️ |
Hello everyone. I just found out to open a link in browser with WSL with following command. cmd.exe /C start http://link/you/want/to/open And, I just put the link of rust book to open with an alias in WSL. The book, which is in .cargo folder, in home directory. alias open_rust_book='cmd.exe /C start file://wsl.localhost/Ubuntu-20.04/home/omni/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/book/ch01-00-getting-started.html' And it worked. I am new to Rust language, learning form its book, so I ended up with this. |
@AbdulxaqDev Thanks for sharing! Have you thought about combining your current solution with @wukaijin's #2206 (comment)? Maybe something like the following (I haven't tested it yet): export BROWSER="cmd.exe /C start" |
Hello @rami3l I got the following error: Opening docs named `book` in your browser
error: couldn't open browser: error spawning command(s) 'cmd.exe /C start ': No such file or directory (os error 2) Or am I using it in wrong way? |
@AbdulxaqDev Oops, it seems to me that https://github.com/Seeker14491/opener requires |
Thank you for explanation @rami3l 👍 |
Thanks @wukaijin this works indeed - like a charm. Simply update the browser path in case the added command fails to fix it: In my case, I had to update like so: export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" |
Problem
On Windows, using WSL 2,
rustup doc --std
(or any otherrustup doc
command) opens firefox correctly (because I haveBROWSER=firefox.exe
), but the browser does not load a file; the browser is empty/blank.I found the rustup docs here:
I could open this manually like this:
Or like this:
Possible Solution(s)
Consider making
rustup doc
aware of how to open files on WSL so they open the docs as expected.Notes
Output of
rustup --version
:rustup 1.21.1 (7832b2e 2019-12-20)
Output of
rustup show
:Default host: x86_64-unknown-linux-gnu
rustup home: /home/kobenauf/.rustup
installed toolchains
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
installed targets for active toolchain
wasm32-unknown-unknown
x86_64-pc-windows-gnu
x86_64-unknown-linux-gnu
active toolchain
nightly-x86_64-unknown-linux-gnu (default)
rustc 1.42.0-nightly (689fca01c 2020-01-17)
The text was updated successfully, but these errors were encountered: