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

Output of cargo metadata may not be machine-readable if the registry needs to be updated #2661

Closed
SSheldon opened this issue May 8, 2016 · 8 comments

Comments

@SSheldon
Copy link

SSheldon commented May 8, 2016

Repro steps:

  1. rm Cargo.lock
  2. cargo metadata

Observe that the JSON output is preceded by:

    Updating registry `https://github.com/rust-lang/crates.io-index`

A workaround is possible by running cargo metadata --quiet, but I can't really imagine that output being wanted in a command whose output is supposed to be machine-readable.

It's a pretty easy edge case to miss since usually your registry doesn't need to be updated. It bit me in SSheldon/rust-test-ios#3.

@SSheldon
Copy link
Author

SSheldon commented May 8, 2016

Oh and I'm running cargo 0.9.0-nightly (8fc3fd8 2016-02-29), apologies if this has since been fixed but I couldn't find anything by searching.

@alexcrichton
Copy link
Member

cc @matklad, I wonder if perhaps cargo metadata should imply a quiet shell by default? Either that or perhaps #1473 would fix this

@matklad
Copy link
Member

matklad commented May 8, 2016

but I can't really imagine that output being wanted in a command whose output is supposed to be machine-readable.

Actually we want that output in IntelliJ-Rust :) cargo metadata may take a while for downloading dependencies, so we use updating registry and downloading foo messages to show a progress bar.

We can make metadata quite by default, and use --verbose to override this.

However I would argue that quite by default is a bad behavior. metadata will cause dependencies to be resolved and downloaded, and you really want to see the feedback. If cargo metada runs for 10 minutes, you want to know if you Internet is slow, or if you wi-fi died, or if maybe cargo is just stuck picking the versions.

#1473 seems like the correct solution here.

Another option is to better document current behavior and to make sure that something (Registry is up to date?) is always printed before the JSON.

@alexcrichton
Copy link
Member

Interesting! Sounds like #1473 is the right solution

@matklad
Copy link
Member

matklad commented May 20, 2016

closed by #2722

@alexcrichton
Copy link
Member

🎊

@matklad
Copy link
Member

matklad commented May 20, 2016

So this will hit stable Rust with 1.10? I need to remember to fix progress reporting on the IntelliJ side

@alexcrichton
Copy link
Member

Yeah that sounds right!

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

No branches or pull requests

3 participants