From 416690915e787c1e87e1cf2258b599b5b6416a92 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Sun, 5 Jan 2025 09:08:51 -0800 Subject: [PATCH] Set cwd for cargo metadata so it can find .cargo/config.toml Fixes #428 --- NEWS.md | 2 ++ src/workspace.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/NEWS.md b/NEWS.md index 13da9efe..79c2b5f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,8 @@ - Changed: Show more type parameters in mutant names, like `impl From<&str> for Foo` rather than `impl From for Foo`. +- Fixed: Support crates that use a non-default Cargo registry. Previously, `cargo metadata` failed with "registry index was not found." + ## 25.0.1-pre3 2025-01-05 - Fixed: Build arm64 binaries for macOS. diff --git a/src/workspace.rs b/src/workspace.rs index 33594003..79e81db7 100644 --- a/src/workspace.rs +++ b/src/workspace.rs @@ -102,6 +102,7 @@ impl Workspace { let metadata = cargo_metadata::MetadataCommand::new() .no_deps() .manifest_path(&manifest_path) + .current_dir(&dir) .verbose(false) .exec() .with_context(|| format!("Failed to run cargo metadata on {manifest_path}"))?;