Skip to content

Commit

Permalink
fix: reset CARGO env var to fix wrong CARGO in commands
Browse files Browse the repository at this point in the history
fixes #1059
  • Loading branch information
wmmc88 committed Mar 27, 2024
1 parent d3c7483 commit 04adb47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,5 +148,5 @@ pub(crate) fn get_cargo_binary_path(toolchain: &ToolchainSpecifier) -> Option<St
}

pub(crate) fn remove_rust_env_vars() {
envmnt::remove_all(&vec!["RUSTC", "RUSTDOC", "RUSTFLAGS"]);
envmnt::remove_all(&vec!["CARGO", "RUSTC", "RUSTDOC", "RUSTFLAGS"]);
}
3 changes: 3 additions & 0 deletions src/lib/toolchain_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,19 @@ fn get_cargo_binary_path_valid() {
#[test]
#[ignore]
fn remove_rust_env_vars_existed() {
envmnt::set("CARGO", "bad0");

Check warning on line 127 in src/lib/toolchain_test.rs

View check run for this annotation

Codecov / codecov/patch

src/lib/toolchain_test.rs#L127

Added line #L127 was not covered by tests
envmnt::set("RUSTC", "bad1");
envmnt::set("RUSTDOC", "bad2");
envmnt::set("RUSTFLAGS", "bad3");

assert!(envmnt::exists("CARGO"));

Check warning on line 132 in src/lib/toolchain_test.rs

View check run for this annotation

Codecov / codecov/patch

src/lib/toolchain_test.rs#L132

Added line #L132 was not covered by tests
assert!(envmnt::exists("RUSTC"));
assert!(envmnt::exists("RUSTDOC"));
assert!(envmnt::exists("RUSTFLAGS"));

remove_rust_env_vars();

assert!(!envmnt::exists("CARGO"));

Check warning on line 139 in src/lib/toolchain_test.rs

View check run for this annotation

Codecov / codecov/patch

src/lib/toolchain_test.rs#L139

Added line #L139 was not covered by tests
assert!(!envmnt::exists("RUSTC"));
assert!(!envmnt::exists("RUSTDOC"));
assert!(!envmnt::exists("RUSTFLAGS"));
Expand Down

0 comments on commit 04adb47

Please sign in to comment.