formulahendry / formulahendry/vscode-code-runner

Configuration: code-runner.executorMap for "rust": "cargo run" uses file names as an argument e.g.: `cargo run "c:\ar\rs\sors\src\main.rs"` the correct answer is `cargo run`

Open
#410 9 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

- VS Code Version: x64 1.30.1 dea8705087adb1b5e5ae1d9123278e178656186a
- OS Version: Microsoft Windows [Version 10.0.17134.345]
- Code Runner Version: 0.9.5

**Describe the bug**
Description of what the bug is.
After editing Configuration: `code-runner.executorMap` from:
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
to:
"rust": "cargo run",
When clicking play button, code-runner command runs:
cargo run "c:\ar\rs\sors\src\main.rs"
The correct command is:
cargo run
note: without extra arguments.
if you put any thing after `cargo run` it will be used as user program argument, so the correct way to run is just `cargo run`.

**To Reproduce**
Steps to reproduce the behavior:

1.
set:
"code-runner.executorMap": {
"rust": "cargo run",
},
2. and run this file "main.rs" (prints arguments list):

use std::env;
fn main() {
for argument in env::args() {
println!(" {}", argument);
}
}

output is:
cargo run "c:\ar\rs\sors\src\main.rs"
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Running `target\debug\sors.exe c:\ar\rs\sors\src\main.rs`
target\debug\sors.exe
c:\ar\rs\sors\src\main.rs

**Expected behavior**
cargo run

---
Thank you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.