More helpful error message if toolchain is not in PATH

This commit is contained in:
Aleksey Kladov 2020-04-24 22:01:32 +02:00
parent 5d97667f8d
commit 6c400b3e33

View file

@ -141,6 +141,11 @@ impl CargoWorkspace {
cargo_toml: &Path, cargo_toml: &Path,
cargo_features: &CargoConfig, cargo_features: &CargoConfig,
) -> Result<CargoWorkspace> { ) -> Result<CargoWorkspace> {
let _ = Command::new(cargo_binary())
.arg("--version")
.status()
.context("failed to run `cargo --version`, is `cargo` in PATH?")?;
let mut meta = MetadataCommand::new(); let mut meta = MetadataCommand::new();
meta.manifest_path(cargo_toml); meta.manifest_path(cargo_toml);
if cargo_features.all_features { if cargo_features.all_features {