cargo
cargo copied to clipboard
```cargo doc --open``` doesn't work on WSL if any of the folders in the path have a space in the name
Problem
Running cargo doc --open in a rust project if the path has any spaces causes it to not open the rust docs in the browser. Instead, we get an error that says command 'wslview' did not execute successfully; exit status: 1 and the stderr is, assuming your path of is "your\ path/your_proj/target/doc/your_proj/index.html",
Start-Process : A positional parameter cannot be found that accepts argument 'path\your_proj\target\doc\your_proj\index.html'.
At line:1 char:1
+ Start your path/your_proj/target/doc/your_proj/index.html
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: :)) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand
I expected cargo doc --open to have already replaced all of the spaces with "\ " so that it wouldn't think each space causes the path to be split up into different arguments.
Steps
- Use WSL for the following steps.
- Create a directory with a space in the name.
- Go in that directory from the terminal and make a new Rust project, using
cargo add - Go into that directory and run
cargo doc --open.
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.65.0
release: 1.65.0
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.58.0 (sys:0.4.59+curl-7.86.0 system ssl:GnuTLS/3.5.18)
os: Ubuntu 18.04 (bionic) [64-bit]
Which version of wslview do you have? You can view it with: wslview --version.
I can't seem to reproduce it myself, so I suspect that it may be due to using a relatively old distribution (Ubuntu 18). You may want to try updating the version of wslview or try a newer distribution.
It is the version wslu v2.0.0; wslview v05. lsb_release -r seems to show that is ubuntu version 18.04. I will update my ubuntu version to the 22 version now.
@ChrisChoi314. Does it still happen with Ubuntu 22?