From a5e97ca54934a192e2bd581b7abb52b644c04353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Grythe=20St=C3=B8dle?= Date: Fri, 27 Mar 2020 22:13:59 +0100 Subject: [PATCH] Respect CARGO_TARGET_DIR when set (#1528) This makes the `binaries` function respect the `CARGO_TARGET_DIR` environment variable when set. If it's not present it falls back to the regular target directory used by Cargo. --- crates/nu-test-support/src/fs.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/nu-test-support/src/fs.rs b/crates/nu-test-support/src/fs.rs index be8287edd..43ea4faa6 100644 --- a/crates/nu-test-support/src/fs.rs +++ b/crates/nu-test-support/src/fs.rs @@ -246,7 +246,10 @@ pub fn root() -> PathBuf { } pub fn binaries() -> PathBuf { - root().join("target/debug") + std::env::var("CARGO_TARGET_DIR") + .ok() + .map(|target_dir| PathBuf::from(target_dir).join("debug")) + .unwrap_or_else(|| root().join("target/debug")) } pub fn fixtures() -> PathBuf {