question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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`

See original GitHub issue
  • 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:

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.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

7reactions
wasmupcommented, Jun 4, 2019

Thanks, I’m using this for Linux now:

  "code-runner.executorMap": {
    "rust": "cargo run # $fileName",
  },
1reaction
doggy8088commented, Oct 29, 2020

@formulahendry If you can add a $empty that put nothing in the command line. That will be awesome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to launch a Rust application from Visual Studio Code?
So the Code Runner runs the cargo run command each time you click the Play button (or pressing keyboard shortcut): From menu: File>Preferences> ......
Read more >
code-runner setting for vscode - use cargo to run instead of ...
I would use cargo --version to check for availability.
Read more >
Setting up Rust with VS Code - Editors and IDEs
Here's how I set up my IDE when I first started: Install Rust (Use this link ... $fileName && $dir$fileNameWithoutExt" to "rust": "cargo...
Read more >
Getting Started with RUST and VSCODE & reading JSON with ...
RUST updates every 6 weeks, so you will want to use rustup update to ... To begin, run cargo new <project-name> and cargo...
Read more >
Run compiled language (C, C++, Java) in Visual Studio Code
Yes! Compiled language! With the coming of Code Runner extension, we could run many interpreted language directly in VS Code without any ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found