Skip to content

Commit

Permalink
Merge pull request #2788 from pre-commit/rustup-home-temporary
Browse files Browse the repository at this point in the history
set RUSTUP_HOME when using a non-system rust
  • Loading branch information
asottile committed Feb 28, 2023
2 parents 294590f + 2700a7d commit 7f386a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pre_commit/languages/rust.py
Expand Up @@ -142,10 +142,15 @@ def install_environment(
else:
packages_to_install.add((package,))

with in_env(prefix, version):
with contextlib.ExitStack() as ctx:
ctx.enter_context(in_env(prefix, version))

if version != 'system':
install_rust_with_toolchain(_rust_toolchain(version))

tmpdir = ctx.enter_context(tempfile.TemporaryDirectory())
ctx.enter_context(envcontext((('RUSTUP_HOME', tmpdir),)))

if len(lib_deps) > 0:
_add_dependencies(prefix, lib_deps)

Expand Down

0 comments on commit 7f386a7

Please sign in to comment.