fix: use _get_user with _update_cache

This commit is contained in:
Daylin Morgan 2024-01-03 13:46:53 -06:00
parent 1bb48eedbc
commit f21b90d962
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F

View file

@ -2461,7 +2461,6 @@ def _get_user() -> str:
try: try:
user = getuser() user = getuser()
except ImportError as e: except ImportError as e:
user = "dummy" user = "dummy"
log.info(e.msg) log.info(e.msg)
@ -2773,7 +2772,6 @@ def use(*packages: str, track_exe: bool = False, name: str = "") -> Path:
vivenv.meta.addfile(get_caller_path()) vivenv.meta.addfile(get_caller_path())
vivenv.meta.write() vivenv.meta.write()
vivenv.activate() vivenv.activate()
return vivenv.path return vivenv.path
@ -3385,7 +3383,9 @@ class Viv:
if run_mode == "ephemeral": if run_mode == "ephemeral":
new_cache = tmpdir new_cache = tmpdir
elif run_mode == "semi-ephemeral": elif run_mode == "semi-ephemeral":
new_cache = str(Path(tempfile.gettempdir()) / "viv-ephemeral-cache") new_cache = str(
Path(tempfile.gettempdir()) / ("viv-ephemeral-cache-" + _get_user())
)
env.update({"VIV_CACHE": new_cache}) env.update({"VIV_CACHE": new_cache})
os.environ["VIV_CACHE"] = new_cache os.environ["VIV_CACHE"] = new_cache