Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try go fix cargo fmt invocation #4620

Closed
wants to merge 1 commit into from

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Oct 3, 2019

Use absolute path $CARGO_HOME/bin/cargo to get cargo path in rustfmt tests.

I get the same error as this is supposed to fix on my system because I have an alias
cargo="cargo --foo on my system.

This causes cargo +nightly check to be resolved to cargo --foo +nightly check which is wrong because the +nightly needs to be the first arg!
Work around by circumventing possible aliasing and using the absolute path to the cargo binary.

changelog: none

@matthiaskrgr
Copy link
Member Author

@bors try
let's see if this works on appveyor...

bors added a commit that referenced this pull request Oct 3, 2019
try go fix cargo fmt invocation

changelog: none
@bors
Copy link
Contributor

bors commented Oct 3, 2019

⌛ Trying commit 7cd36b2 with merge acd2268...

@bors
Copy link
Contributor

bors commented Oct 3, 2019

💔 Test failed - status-appveyor

@matthiaskrgr
Copy link
Member Author

Hm, apparently C:\Users\appveyor\.cargo\bin\cargo is not the location of the cargo binary on appveyor...?

@@ -1,3 +1,4 @@
use home;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this in 2018 edition

Suggested change
use home;

// because we will end up with cargo --foo +nightly fmt but the "+nightly" needs to come first
// get the absolute path to the cargo binary inside $CARGO_HOME
let cargo_home = home::cargo_home().expect("failed to get cargo home path!");
let cargo_path = cargo_home.join("bin").join("cargo");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let cargo_path = cargo_home.join("bin").join("cargo");
let cargo_path = cargo_home.join("bin").join(format!("cargo{}", std::env::consts::EXE_SUFFIX));

@matthiaskrgr
Copy link
Member Author

The issue turned out to be a cargo bug: rust-lang/cargo#7475

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

Successfully merging this pull request may close these issues.

3 participants