Skip to content

Commit

Permalink
Add workaround for RUSTUP_WINDOWS_PATH_ADD_BIN.
Browse files Browse the repository at this point in the history
On Windows, rustup has an issue with recursive cargo invocations. This
commit can be removed once
rust-lang/rustup#3036 is resolved.
  • Loading branch information
ehuss authored and charmitro committed Sep 13, 2024
1 parent 04cda3b commit 2edfe8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ jobs:
CARGO_PROFILE_TEST_DEBUG: 1
CARGO_INCREMENTAL: 0
CARGO_PUBLIC_NETWORK_TESTS: 1
# Workaround for https://github.com/rust-lang/rustup/issues/3036
RUSTUP_WINDOWS_PATH_ADD_BIN: 0
strategy:
matrix:
include:
Expand Down Expand Up @@ -170,7 +172,6 @@ jobs:
- name: Configure extra test environment
run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
if: matrix.os == 'ubuntu-latest'

- run: cargo test -p cargo
- name: Clear intermediate test output
run: ci/clean-test-output.sh
Expand Down
7 changes: 7 additions & 0 deletions crates/cargo-test-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ fn has_rustup_stable() -> bool {
// This cannot run on rust-lang/rust CI due to the lack of rustup.
return false;
}
if cfg!(windows) && !is_ci() && option_env!("RUSTUP_WINDOWS_PATH_ADD_BIN").is_none() {
// There is an issue with rustup that doesn't allow recursive cargo
// invocations. Disable this on developer machines if the environment
// variable is not enabled. This can be removed once
// https://github.com/rust-lang/rustup/issues/3036 is resolved.
return false;
}
check_command("cargo", &["+stable", "--version"])
}

Expand Down

0 comments on commit 2edfe8d

Please sign in to comment.