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.

--color=always causes issues on Linux when trying to pass through arguments using Cargo

See original GitHub issue

There appears to be an issue trying to use Cargo’s pass through arguments.

Under Additional Arguments under a run configuration, to pass CLI arguments to the binary you are trying to run, you need to separate Cargo’s parameters from your binary’s parameters with -- (two dash’s).

However it seems that --color=always on Linux is dynamically added to the end of the list of arguments passed to Cargo. This means that in this case, the argument is instead passed to the binary instead of Cargo.

Given Additional Arguments: --bin numfmt -- --help

Output:

/home/<user>/.cargo/bin/cargo run --bin numfmt -- --help --color=always
    Finished debug [unoptimized + debuginfo] target(s) in 0.2 secs
     Running `target/debug/numfmt --help --color=always`
numfmt: error: Unrecognized option: 'color'.

Process finished with exit code 1

Added here: https://github.com/intellij-rust/intellij-rust/pull/801/files#diff-5420463ef1508e0dd1db9c82ad7a823eR86

Looks like it could be fixed by just prepending instead of appending, or looking for the existence of --.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
matkladcommented, Dec 11, 2016

Fixed by https://github.com/intellij-rust/intellij-rust/pull/828.

Should be in nightly today and in alpha tomorrow!

0reactions
sanmai-NLcommented, Oct 5, 2017

@juszczakn: have you come around to adding a test, or should it be picked up by someone else?

Read more comments on GitHub >

github_iconTop Results From Across the Web

A terminal case of Linux - fasterthanli.me
You want to look at a JSON file in your terminal, so you pipe it into jq ... --color with no argument is...
Read more >
bat - crates.io: Rust Package Registry
You can use the -A / --show-all option to show and highlight ... To do this, use bat s --color=always option to force...
Read more >
How do I pass the linker the -rlink argument? - Stack Overflow
1 Answer 1 ... Cargo allows placing the same kind of flag in the configuration file (see here) but I'm not sure if...
Read more >
Arg in clap - Rust - Docs.rs
The name is used to check whether or not the argument was used at runtime, get values, set relationships with other args, etc.....
Read more >
Using command-line arguments ('argv') | Rust Verification Tools
One important difference between C and Rust is that the C main function expects to be given a list of command line arguments...
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