10824: project_model: print full cargo command if cargo metadata fails to run r=Veykril a=jhgg

well, `Command` implements a sensible `Debug` which *roughly* does what we want to do. Unfortunately it's got a bit of a quote situation,

So it'd output something like `"cargo" "metadata"  "--format-version" "1" "--features" "foo,bar,baz"`. 

Which although is a bit verbose with the quotes, it's at the very least, not entirely incorrect/misleading.

fixes #10797

Co-authored-by: Jake Heinz <jh@discordapp.com>
This commit is contained in:
bors[bot] 2021-11-25 15:12:38 +00:00 committed by GitHub
commit 870e730dc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,9 +286,8 @@ impl CargoWorkspace {
// unclear whether cargo itself supports it. // unclear whether cargo itself supports it.
progress("metadata".to_string()); progress("metadata".to_string());
let meta = meta.exec().with_context(|| { let meta =
format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display(),) meta.exec().with_context(|| format!("Failed to run `{:?}`", meta.cargo_command()))?;
})?;
Ok(meta) Ok(meta)
} }