Skip to content

Commit 9ceae68

Browse files
Error if the CARGO_TARGET_DIR is an empty string
1 parent 4eff829 commit 9ceae68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cargo/util/config/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl Config {
451451
Ok(Some(dir.clone()))
452452
} else if let Some(dir) = env::var_os("CARGO_TARGET_DIR") {
453453
if dir.to_str().unwrap().trim() == "" {
454-
return Ok(Some(Filesystem::new(self.cwd.join("target"))));
454+
anyhow::bail!("The CARGO_TARGET_DIR environment variable is an empty string. Try adding the target directory name to it or deleting the variable.")
455455
}
456456

457457
Ok(Some(Filesystem::new(self.cwd.join(dir))))

0 commit comments

Comments
 (0)