Skip to content

Commit 522b091

Browse files
committed
[cargo-zerocopy] Auto-install env var toggle
When the environment variable `CARGO_ZEROCOPY_AUTO_INSTALL_TOOLCHAIN` is set, auto-install toolchains without prompting the user. gherrit-pr-id: Ic5070e48a9b829ca68b8356d44b42bd97543ead9
1 parent 8134d9e commit 522b091

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/cargo-zerocopy/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ fn install_toolchain_or_exit(versions: &Versions, name: &str) -> Result<(), Erro
142142
eprintln!("[cargo-zerocopy] missing either toolchain '{name}' or component 'rust-src'");
143143
if env::vars().any(|v| v.0 == "GITHUB_RUN_ID") {
144144
eprint!("[cargo-zerocopy] detected GitHub Actions environment; auto-installing without waiting for confirmation");
145+
} else if env::vars().any(|v| v.0 == "CARGO_ZEROCOPY_AUTO_INSTALL_TOOLCHAIN") {
146+
eprint!("[cargo-zerocopy] detected CARGO_ZEROCOPY_AUTO_INSTALL_TOOLCHAIN environment variable; auto-installing without waiting for confirmation");
145147
} else {
146148
loop {
147149
eprint!("[cargo-zerocopy] would you like to install toolchain '{name}' and component 'rust-src' via 'rustup' (y/n)? ");

0 commit comments

Comments
 (0)