fix(test-support): use CARGO_BUILD_TARGET_DIR env var (#15212)

# Description

cargo uses both CARGO_BUILD_TARGET_DIR and CARGO_TARGET_DIR, so check
for CARGO_BUILD_TARGET_DIR if CARGO_TARGET_DIR is not found

https://doc.rust-lang.org/cargo/reference/config.html#buildtarget-dir
This commit is contained in:
hardfault 2025-02-28 19:08:44 +00:00 committed by GitHub
parent 52a35827c7
commit 93612974e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -88,6 +88,7 @@ pub fn binaries() -> AbsolutePathBuf {
}; };
std::env::var("CARGO_TARGET_DIR") std::env::var("CARGO_TARGET_DIR")
.or_else(|_| std::env::var("CARGO_BUILD_TARGET_DIR"))
.ok() .ok()
.and_then(|p| AbsolutePathBuf::try_from(p).ok()) .and_then(|p| AbsolutePathBuf::try_from(p).ok())
.unwrap_or_else(|| root().join("target")) .unwrap_or_else(|| root().join("target"))