Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

args to custom run command not working correctly on windows (spaces?) #224

Closed
radix opened this issue May 2, 2017 · 7 comments
Closed

Comments

@radix
Copy link
Contributor

radix commented May 2, 2017

Version of VSCode: 1.11.2
Version of the extension: 0.3.14
OS: Windows 10

Description:

I have a custom run configuration like this:

    "rust.customRunConfigurations": [
        {
            "title": "PTRPI campaign",
            "args": ["--", "C:\\Users\\radix\\Google Drive\\RPG\\FolioRPG\\PTCampaigns", "eberron.yaml"]
        },
        {
            "title": "release",
            "args": [ "--release" ]
        }
    ],

Since the latest update, I can't use it any more. It seems that the command is now being run in PowerShell, and my guess is that it's not escaping spaces correctly (e.g. in the "Google Drive" path).

Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.

Loading personal and system profiles took 545ms.
C:\Users\radix\Projects\pandt [master ≡ +0 ~2 -0 !]> $ENV:RUST_BACKTRACE="1"
C:\Users\radix\Projects\pandt [master ≡ +0 ~2 -0 !]> $ENV:CARGO_INCREMENTAL="1"
>>
C:\Users\radix\Projects\pandt [master ≡ +0 ~2 -0 !]> cd "c:\Users\radix\Projects\pandt\ptrpi"
>>
C:\Users\radix\Projects\pandt\ptrpi [master ≡ +0 ~2 -0 !]> cargo run -- C:\Users\radix\Google Drive\RPG\FolioRPG\PTCampaigns eberron.yaml
>>
    Finished dev [unoptimized + debuginfo] target(s) in 0.1 secs
     Running `C:\Users\radix\Projects\pandt\target\debug\ptrpi.exe C:\Users\radix\Google Drive\RPG\FolioRPG\PTCampaigns eberron.yaml`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 3, message: "The system cannot find the path specified." } }',
 src\libcore\result.rs:859
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: core::result::Result<std::fs::File, std::io::error::Error>::unwrap<std::fs::File,std::io::error::Error>
             at C:\projects\rust\src\libcore\result.rs:737
   1: ptrpi::load_app_from_path
             at .\src\main.rs:194
   2: ptrpi::main
             at .\src\main.rs:213
error: process didn't exit successfully: `C:\Users\radix\Projects\pandt\target\debug\ptrpi.exe C:\Users\radix\Google Drive\RPG\FolioRPG\PTCampaigns eberron.yam
l` (exit code: 101)
C:\Users\radix\Projects\pandt\ptrpi [master ≡ +0 ~2 -0 !]>
>>

Output of the "Rust logging" channel:

DEBUG: Configuration: Rustup: create: sysroot=C:\Users\radix\.rustup\toolchains\nightly-x86_64-pc-windows-msvc
DEBUG: Configuration: Rustup: updateComponents: this.components=["cargo-x86_64-pc-windows-msvc (default)","rls-x86_64-pc-windows-msvc (installed)","rust-analysis-x86_64-pc-windows-msvc (installed)","rust-docs-x86_64-pc-windows-msvc (default)","rust-src (installed)","rust-std-aarch64-apple-ios","rust-std-aarch64-linux-android","rust-std-aarch64-unknown-fuchsia","rust-std-aarch64-unknown-linux-gnu","rust-std-arm-linux-androideabi","rust-std-arm-unknown-linux-gnueabi","rust-std-arm-unknown-linux-gnueabihf","rust-std-arm-unknown-linux-musleabi","rust-std-arm-unknown-linux-musleabihf","rust-std-armv7-apple-ios","rust-std-armv7-linux-androideabi","rust-std-armv7-unknown-linux-gnueabihf","rust-std-armv7-unknown-linux-musleabihf","rust-std-armv7s-apple-ios","rust-std-asmjs-unknown-emscripten","rust-std-i386-apple-ios","rust-std-i586-pc-windows-msvc","rust-std-i586-unknown-linux-gnu","rust-std-i686-apple-darwin","rust-std-i686-linux-android","rust-std-i686-pc-windows-gnu","rust-std-i686-pc-windows-msvc","rust-std-i686-unknown-freebsd","rust-std-i686-unknown-linux-gnu","rust-std-i686-unknown-linux-musl","rust-std-mips-unknown-linux-gnu","rust-std-mips-unknown-linux-musl","rust-std-mips64-unknown-linux-gnuabi64","rust-std-mips64el-unknown-linux-gnuabi64","rust-std-mipsel-unknown-linux-gnu","rust-std-mipsel-unknown-linux-musl","rust-std-powerpc-unknown-linux-gnu","rust-std-powerpc64-unknown-linux-gnu","rust-std-powerpc64le-unknown-linux-gnu","rust-std-s390x-unknown-linux-gnu","rust-std-sparc64-unknown-linux-gnu","rust-std-wasm32-unknown-emscripten","rust-std-x86_64-apple-darwin","rust-std-x86_64-apple-ios","rust-std-x86_64-pc-windows-gnu","rust-std-x86_64-pc-windows-msvc (default)","rust-std-x86_64-rumprun-netbsd","rust-std-x86_64-unknown-freebsd","rust-std-x86_64-unknown-fuchsia","rust-std-x86_64-unknown-linux-gnu","rust-std-x86_64-unknown-linux-musl","rust-std-x86_64-unknown-netbsd","rustc-x86_64-pc-windows-msvc (default)",""]
DEBUG: Configuration: Rustup: updatePathToRlsExecutable: rlsInstalled=true
DEBUG: Configuration: Rustup: updatePathToRlsExecutable: rlsPath=C:\Users\radix\.cargo\bin\rls.EXE
DEBUG: runInRlsMode: rlsPath=C:\Users\radix\.cargo\bin\rls.EXE
DEBUG: runInRlsMode: env={"RUST_SRC_PATH":"C:/Users/radix/.multirust/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/src/rust/src/"}
DEBUG: runInRlsMode: args=[]
DEBUG: runInRlsMode: revealOutputChannelOn=3
DEBUG: Language Client Manager: start
@KalitaAlexey
Copy link
Member

It may be related to #218
I actually don't know.
@BusyJay, can you answer if the problems are similar?

@radix
Copy link
Contributor Author

radix commented May 2, 2017

as a workaround I was able to get it working by changing my configuration to include quotes around the path:

            "args": ["--", "\"C:\\Users\\radix\\Google Drive\\RPG\\FolioRPG\\PTCampaigns\"", "eberron.yaml"]

so maybe vscode-rust should quote all arguments automatically? I don't know if this would cause problems elsewhere though.

@KalitaAlexey
Copy link
Member

@radix,
@BusyJay pointed to NodeJS issue.
It's not my issue and I am not going to write any workaround.

@radix
Copy link
Contributor Author

radix commented May 2, 2017

I don't really know the details that well, but it doesn't look like exactly the same issue? it seems the nodeJS bug is about when the command has a space, but I don't think the command here has a space.

edit: by "command", I mean "executable path"

@KalitaAlexey
Copy link
Member

I suppose NodeJS behave the same disregarding whether it is an executable path or an argument

@KalitaAlexey
Copy link
Member

I do actually think it is easy to avoid, so I am going to open a PR to fix this.

@KalitaAlexey
Copy link
Member

I was wrong. It is not easy)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants