Skip to content

cargo doc --open doesn't work on WSL if any of the folders in the path have a space in the name #11920

Open
@ChrisChoi314

Description

@ChrisChoi314

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

  1. Use WSL for the following steps.
  2. Create a directory with a space in the name.
  3. Go in that directory from the terminal and make a new Rust project, using cargo add
  4. 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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-docO-windowsOS: WindowsS-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions